Skip to content

Commit da74953

Browse files
committed
feat: add CSV syntax highlighting
1 parent 60913da commit da74953

23 files changed

+352
-8
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ This [EclipseⓇ](https://eclipse.org) plug-in adds syntax highlighting support
2727
1. Carbon - https://carbon-lang.dev
2828
1. COBOL - https://en.wikipedia.org/wiki/COBOL
2929
1. Crystal (`*.cr`) - https://crystal-lang.org/
30+
1. CSV (`*.cvs`) / TSV (`*.tab*`, `*.tsv*`)
3031
1. D2 - https://d2lang.com/
3132
1. Eclipse External null Annotations (`*.eea`) - https://wiki.eclipse.org/JDT_Core/Null_Analysis/External_Annotations#File_format
3233
1. EditorConfig - https://editorconfig.org
@@ -118,6 +119,7 @@ To install the plugin into an existing Eclipse installation do:
118119
| COBOL <img src="plugin/syntaxes/cobol/icon.png" width=16/> | file-extensions="cbl, cob, cobol, copy, cpy"<br />file-patterns="\*\*/broadcommfd.cobol-language-support/\*/copybooks/\*\*" | [development@eclipse-che4z/che-che4z-lsp-for-cobol](https://github.com/eclipse-che4z/che-che4z-lsp-for-cobol/tree/86c38c8fc9702ff93bc032ae392cc19ca7362dee/clients/cobol-lsp-vscode-extension)
119120
| Crystal <img src="plugin/syntaxes/crystal/icon.png" width=16/> | file-extensions="cr" | [master@crystal-lang-tools/vscode-crystal-lang](https://github.com/crystal-lang-tools/vscode-crystal-lang/tree/d1be719abf9bff0c722cb3127948e33361fc74e0/) [[upstream]](https://github.com/Microsoft/vscode/blob/3f1f36333d3453f67a36b6bfb1206e9159e9c4f0/extensions/ruby/syntaxes/ruby.tmLanguage.json)
120121
| Crystal Slang <img src="plugin/syntaxes/crystal/icon.png" width=16/> | file-extensions="slang" | [master@crystal-lang-tools/vscode-crystal-lang](https://github.com/crystal-lang-tools/vscode-crystal-lang/tree/d1be719abf9bff0c722cb3127948e33361fc74e0/)
122+
| CSV <img src="plugin/syntaxes/csv/icon.png" width=16/> | file-extensions="csv" | [master@mechatroner/vscode_rainbow_csv](https://github.com/mechatroner/vscode_rainbow_csv/tree/18c3cb377fd42128f39ff21706efdc1d6a73efc0/)
121123
| d2 <img src="plugin/syntaxes/d2/d2.png" width=16/> | file-extensions="d2" | [master@terrastruct/d2-vscode](https://github.com/terrastruct/d2-vscode/tree/88d9716009f9b8d65bfd6dea96064c94a5cf275f/)
122124
| EditorConfig <img src="plugin/syntaxes/editorconfig/icon.png" width=16/> | file-extensions="editorconfig" | [main@editorconfig/editorconfig-vscode](https://github.com/editorconfig/editorconfig-vscode/tree/02aea3dc4b51e07376ff27472aacf99481322fc5/)
123125
| Elm <img src="plugin/syntaxes/elm/icon.png" width=16/> | file-extensions="elm" | [main@elm-tooling/elm-language-client-vscode](https://github.com/elm-tooling/elm-language-client-vscode/tree/a32f6a908c113ea4710d18b612a7ecd70f0a2c8b/)
@@ -192,6 +194,7 @@ To install the plugin into an existing Eclipse installation do:
192194
| Starlark <img src="plugin/syntaxes/bazel/icon.png" width=16/> | file-extensions="BUILD, WORKSPACE, bazel, bzl, bzlmod, sky, star"<br />file-names="BUILD, WORKSPACE" | [master@bazelbuild/vscode-bazel](https://github.com/bazelbuild/vscode-bazel/tree/7b6f85f9d08d0b6d1f1991f05e09cfcd8740407e/)
193195
| Svelte <img src="plugin/syntaxes/svelte/icon.png" width=16/> | file-extensions="svelte" | [master@sveltejs/language-tools](https://github.com/sveltejs/language-tools/tree/ef92ff314e6f647c10c36b04c151da911453e19e/packages/svelte-vscode)
194196
| TOML Config File <img src="plugin/syntaxes/toml/icon.png" width=16/> | file-extensions="toml"<br />file-names="Cargo.lock, Pipfile, pdm.lock" | [master@juggernautjp/less-toml](https://github.com/juggernautjp/less-toml/tree/13eb891232e98c4a9c595bf8c657893c84edf3a9/) [[upstream]](https://github.com/textmate/toml.tmbundle/commit/e82b64c1e86396220786846201e9aa3f0a2d9ca2)
197+
| TSV <img src="plugin/syntaxes/csv/icon.png" width=16/> | file-extensions="tab, tsv" | [master@mechatroner/vscode_rainbow_csv](https://github.com/mechatroner/vscode_rainbow_csv/tree/18c3cb377fd42128f39ff21706efdc1d6a73efc0/)
195198
| Wing <img src="plugin/syntaxes/wing/wing.png" width=16/> | file-extensions="w, wsim" | [main@winglang/wing](https://github.com/winglang/wing/tree/43ec45981cbb3f08b19d882e86f068e7eebc6c66/packages/vscode-wing)
196199
| Zig <img src="plugin/syntaxes/zig/icon.png" width=16/> | file-extensions="zig, zon" | [master@ziglang/vscode-zig](https://github.com/ziglang/vscode-zig/tree/dba6b80173d92c002ba7f32d03a22e3d4253b0da/)
197200

plugin/plugin.xml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,110 @@
372372
<snippet name="Crystal Slang Example" path="syntaxes/crystal/slang.example.slang" scopeName="text.slang" />
373373
</extension>
374374

375+
<!-- ======================================== -->
376+
<!-- csv/csv: CSV -->
377+
<!-- ======================================== -->
378+
<extension point="org.eclipse.core.contenttype.contentTypes">
379+
<content-type id="extra-syntax-highlighting.csv" name="CSV" base-type="extra-syntax-highlighting.basetype" priority="normal"
380+
file-extensions="csv" />
381+
</extension>
382+
<extension point="org.eclipse.tm4e.registry.grammars">
383+
<grammar scopeName="text.csv" path="syntaxes/csv/csv.tmLanguage.json" />
384+
<scopeNameContentTypeBinding scopeName="text.csv" contentTypeId="extra-syntax-highlighting.csv" />
385+
</extension>
386+
387+
<extension point="org.eclipse.tm4e.languageconfiguration.languageConfigurations">
388+
<languageConfiguration contentTypeId="extra-syntax-highlighting.csv" path="syntaxes/csv/csv.language-configuration.json" />
389+
</extension>
390+
391+
<extension point="org.eclipse.ui.genericeditor.icons">
392+
<icon contentType="extra-syntax-highlighting.csv" icon="syntaxes/csv/icon.png"/>
393+
</extension>
394+
395+
<!-- ======================================== -->
396+
<!-- csv/csv (pipe): CSV (pipe) -->
397+
<!-- ======================================== -->
398+
<extension point="org.eclipse.core.contenttype.contentTypes">
399+
<content-type id="extra-syntax-highlighting.csv (pipe)" name="CSV (pipe)" base-type="extra-syntax-highlighting.basetype" priority="normal"
400+
file-names="PREVENT_FILE_ASSOCIATION_INHERITANCE" />
401+
</extension>
402+
<extension point="org.eclipse.tm4e.registry.grammars">
403+
<grammar scopeName="text.psv" path="syntaxes/csv/csv_(pipe).tmLanguage.json" />
404+
<scopeNameContentTypeBinding scopeName="text.psv" contentTypeId="extra-syntax-highlighting.csv (pipe)" />
405+
</extension>
406+
407+
<extension point="org.eclipse.ui.genericeditor.icons">
408+
<icon contentType="extra-syntax-highlighting.csv (pipe)" icon="syntaxes/csv/icon.png"/>
409+
</extension>
410+
411+
<!-- ======================================== -->
412+
<!-- csv/csv (semicolon): CSV (semicolon) -->
413+
<!-- ======================================== -->
414+
<extension point="org.eclipse.core.contenttype.contentTypes">
415+
<content-type id="extra-syntax-highlighting.csv (semicolon)" name="CSV (semicolon)" base-type="extra-syntax-highlighting.basetype" priority="normal"
416+
file-names="PREVENT_FILE_ASSOCIATION_INHERITANCE" />
417+
</extension>
418+
<extension point="org.eclipse.tm4e.registry.grammars">
419+
<grammar scopeName="text.scsv" path="syntaxes/csv/csv_(semicolon).tmLanguage.json" />
420+
<scopeNameContentTypeBinding scopeName="text.scsv" contentTypeId="extra-syntax-highlighting.csv (semicolon)" />
421+
</extension>
422+
423+
<extension point="org.eclipse.ui.genericeditor.icons">
424+
<icon contentType="extra-syntax-highlighting.csv (semicolon)" icon="syntaxes/csv/icon.png"/>
425+
</extension>
426+
427+
<!-- ======================================== -->
428+
<!-- csv/csv (whitespace): CSV (whitespace) -->
429+
<!-- ======================================== -->
430+
<extension point="org.eclipse.core.contenttype.contentTypes">
431+
<content-type id="extra-syntax-highlighting.csv (whitespace)" name="CSV (whitespace)" base-type="extra-syntax-highlighting.basetype" priority="normal"
432+
file-names="PREVENT_FILE_ASSOCIATION_INHERITANCE" />
433+
</extension>
434+
<extension point="org.eclipse.tm4e.registry.grammars">
435+
<grammar scopeName="text.wspcsv" path="syntaxes/csv/csv_(whitespace).tmLanguage.json" />
436+
<scopeNameContentTypeBinding scopeName="text.wspcsv" contentTypeId="extra-syntax-highlighting.csv (whitespace)" />
437+
</extension>
438+
439+
<extension point="org.eclipse.ui.genericeditor.icons">
440+
<icon contentType="extra-syntax-highlighting.csv (whitespace)" icon="syntaxes/csv/icon.png"/>
441+
</extension>
442+
443+
<!-- ======================================== -->
444+
<!-- csv/dynamic csv: Dynamic CSV -->
445+
<!-- ======================================== -->
446+
<extension point="org.eclipse.core.contenttype.contentTypes">
447+
<content-type id="extra-syntax-highlighting.dynamic csv" name="Dynamic CSV" base-type="extra-syntax-highlighting.basetype" priority="normal"
448+
file-names="PREVENT_FILE_ASSOCIATION_INHERITANCE" />
449+
</extension>
450+
<extension point="org.eclipse.tm4e.registry.grammars">
451+
<grammar scopeName="text.dynamiccsv" path="syntaxes/csv/dynamic_csv.tmLanguage.json" />
452+
<scopeNameContentTypeBinding scopeName="text.dynamiccsv" contentTypeId="extra-syntax-highlighting.dynamic csv" />
453+
</extension>
454+
455+
<extension point="org.eclipse.ui.genericeditor.icons">
456+
<icon contentType="extra-syntax-highlighting.dynamic csv" icon="syntaxes/csv/icon.png"/>
457+
</extension>
458+
459+
<!-- ======================================== -->
460+
<!-- csv/tsv: TSV -->
461+
<!-- ======================================== -->
462+
<extension point="org.eclipse.core.contenttype.contentTypes">
463+
<content-type id="extra-syntax-highlighting.tsv" name="TSV" base-type="extra-syntax-highlighting.basetype" priority="normal"
464+
file-extensions="tab,tsv" />
465+
</extension>
466+
<extension point="org.eclipse.tm4e.registry.grammars">
467+
<grammar scopeName="text.tsv" path="syntaxes/csv/tsv.tmLanguage.json" />
468+
<scopeNameContentTypeBinding scopeName="text.tsv" contentTypeId="extra-syntax-highlighting.tsv" />
469+
</extension>
470+
471+
<extension point="org.eclipse.tm4e.languageconfiguration.languageConfigurations">
472+
<languageConfiguration contentTypeId="extra-syntax-highlighting.tsv" path="syntaxes/csv/tsv.language-configuration.json" />
473+
</extension>
474+
475+
<extension point="org.eclipse.ui.genericeditor.icons">
476+
<icon contentType="extra-syntax-highlighting.tsv" icon="syntaxes/csv/icon.png"/>
477+
</extension>
478+
375479
<!-- ======================================== -->
376480
<!-- d2/d2: d2 -->
377481
<!-- ======================================== -->

plugin/syntaxes/csv/LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2017 Dmitry Ignatovich
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"autoClosingPairs": [
3+
["\"", "\""]
4+
],
5+
"surroundingPairs": [
6+
["\"", "\""]
7+
]
8+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{ "name": "csv syntax",
2+
"scopeName": "text.csv",
3+
"fileTypes": ["csv"],
4+
"patterns": [
5+
{ "match": "((?: *\"(?:[^\"]*\"\")*[^\"]*\" *(?:,|$))|(?:[^,]*(?:,|$)))?((?: *\"(?:[^\"]*\"\")*[^\"]*\" *(?:,|$))|(?:[^,]*(?:,|$)))?((?: *\"(?:[^\"]*\"\")*[^\"]*\" *(?:,|$))|(?:[^,]*(?:,|$)))?((?: *\"(?:[^\"]*\"\")*[^\"]*\" *(?:,|$))|(?:[^,]*(?:,|$)))?((?: *\"(?:[^\"]*\"\")*[^\"]*\" *(?:,|$))|(?:[^,]*(?:,|$)))?((?: *\"(?:[^\"]*\"\")*[^\"]*\" *(?:,|$))|(?:[^,]*(?:,|$)))?((?: *\"(?:[^\"]*\"\")*[^\"]*\" *(?:,|$))|(?:[^,]*(?:,|$)))?((?: *\"(?:[^\"]*\"\")*[^\"]*\" *(?:,|$))|(?:[^,]*(?:,|$)))?((?: *\"(?:[^\"]*\"\")*[^\"]*\" *(?:,|$))|(?:[^,]*(?:,|$)))?((?: *\"(?:[^\"]*\"\")*[^\"]*\" *(?:,|$))|(?:[^,]*(?:,|$)))?",
6+
"name": "rainbowgroup",
7+
"captures": {
8+
"1": {"name": "rainbow1"},
9+
"2": {"name": "keyword.rainbow2"},
10+
"3": {"name": "entity.name.function.rainbow3"},
11+
"4": {"name": "comment.rainbow4"},
12+
"5": {"name": "string.rainbow5"},
13+
"6": {"name": "variable.parameter.rainbow6"},
14+
"7": {"name": "constant.numeric.rainbow7"},
15+
"8": {"name": "entity.name.type.rainbow8"},
16+
"9": {"name": "markup.bold.rainbow9"},
17+
"10": {"name": "invalid.rainbow10"}
18+
}
19+
}
20+
21+
],
22+
"uuid": "ca03e352-04ef-4340-9a6b-9b99aae1c418"
23+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"autoClosingPairs": [
3+
["\"", "\""]
4+
],
5+
"surroundingPairs": [
6+
["\"", "\""]
7+
]
8+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{ "name": "pipe syntax",
2+
"scopeName": "text.psv",
3+
"fileTypes": [],
4+
"patterns": [
5+
{ "match": "([^|]*\\|?)([^|]*\\|?)([^|]*\\|?)([^|]*\\|?)([^|]*\\|?)([^|]*\\|?)([^|]*\\|?)([^|]*\\|?)([^|]*\\|?)([^|]*\\|?)",
6+
"name": "rainbowgroup",
7+
"captures": {
8+
"1": {"name": "rainbow1"},
9+
"2": {"name": "keyword.rainbow2"},
10+
"3": {"name": "entity.name.function.rainbow3"},
11+
"4": {"name": "comment.rainbow4"},
12+
"5": {"name": "string.rainbow5"},
13+
"6": {"name": "variable.parameter.rainbow6"},
14+
"7": {"name": "constant.numeric.rainbow7"},
15+
"8": {"name": "entity.name.type.rainbow8"},
16+
"9": {"name": "markup.bold.rainbow9"},
17+
"10": {"name": "invalid.rainbow10"}
18+
}
19+
}
20+
21+
],
22+
"uuid": "ca13e332-04ef-1340-9a6b-9b99aae1c418"
23+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"autoClosingPairs": [
3+
["\"", "\""]
4+
],
5+
"surroundingPairs": [
6+
["\"", "\""]
7+
]
8+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{ "name": "scsv syntax",
2+
"scopeName": "text.scsv",
3+
"fileTypes": ["scsv"],
4+
"patterns": [
5+
{ "match": "((?: *\"(?:[^\"]*\"\")*[^\"]*\" *(?:;|$))|(?:[^;]*(?:;|$)))?((?: *\"(?:[^\"]*\"\")*[^\"]*\" *(?:;|$))|(?:[^;]*(?:;|$)))?((?: *\"(?:[^\"]*\"\")*[^\"]*\" *(?:;|$))|(?:[^;]*(?:;|$)))?((?: *\"(?:[^\"]*\"\")*[^\"]*\" *(?:;|$))|(?:[^;]*(?:;|$)))?((?: *\"(?:[^\"]*\"\")*[^\"]*\" *(?:;|$))|(?:[^;]*(?:;|$)))?((?: *\"(?:[^\"]*\"\")*[^\"]*\" *(?:;|$))|(?:[^;]*(?:;|$)))?((?: *\"(?:[^\"]*\"\")*[^\"]*\" *(?:;|$))|(?:[^;]*(?:;|$)))?((?: *\"(?:[^\"]*\"\")*[^\"]*\" *(?:;|$))|(?:[^;]*(?:;|$)))?((?: *\"(?:[^\"]*\"\")*[^\"]*\" *(?:;|$))|(?:[^;]*(?:;|$)))?((?: *\"(?:[^\"]*\"\")*[^\"]*\" *(?:;|$))|(?:[^;]*(?:;|$)))?",
6+
"name": "rainbowgroup",
7+
"captures": {
8+
"1": {"name": "rainbow1"},
9+
"2": {"name": "keyword.rainbow2"},
10+
"3": {"name": "entity.name.function.rainbow3"},
11+
"4": {"name": "comment.rainbow4"},
12+
"5": {"name": "string.rainbow5"},
13+
"6": {"name": "variable.parameter.rainbow6"},
14+
"7": {"name": "constant.numeric.rainbow7"},
15+
"8": {"name": "entity.name.type.rainbow8"},
16+
"9": {"name": "markup.bold.rainbow9"},
17+
"10": {"name": "invalid.rainbow10"}
18+
}
19+
}
20+
21+
],
22+
"uuid": "cb13e352-03bf-4340-9a6b-9b99aae1c418"
23+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"autoClosingPairs": [
3+
["\"", "\""]
4+
],
5+
"surroundingPairs": [
6+
["\"", "\""]
7+
]
8+
}

0 commit comments

Comments
 (0)