aboutsummaryrefslogtreecommitdiff
path: root/editors/vscode/syntaxes
diff options
context:
space:
mode:
authorDamian Tarnawski <gthetarnav@gmail.com>2024-04-20 13:11:04 +0200
committerDamian Tarnawski <gthetarnav@gmail.com>2024-04-20 13:11:04 +0200
commit5dadffc771754be293f3e5c8c4e7701ea2fde548 (patch)
treef051050b803d85f7284dc458a90e390280aeef22 /editors/vscode/syntaxes
parentba538e8c2e92edbda1d7f4083e7685541efd8419 (diff)
Add improved grammars for import declarations
highlights namespace that the import provides
Diffstat (limited to 'editors/vscode/syntaxes')
-rw-r--r--editors/vscode/syntaxes/odin.tmLanguage.json27
1 files changed, 27 insertions, 0 deletions
diff --git a/editors/vscode/syntaxes/odin.tmLanguage.json b/editors/vscode/syntaxes/odin.tmLanguage.json
index bd41c02..b3d5886 100644
--- a/editors/vscode/syntaxes/odin.tmLanguage.json
+++ b/editors/vscode/syntaxes/odin.tmLanguage.json
@@ -4,6 +4,7 @@
"name": "Odin",
"patterns": [
{ "include": "#package-name-declaration" },
+ { "include": "#import-declaration" },
{ "include": "#statements" }
],
"repository": {
@@ -217,6 +218,32 @@
"2": { "name": "entity.name.type.module.odin" }
}
},
+ "import-declaration": {
+ "name": "meta.import.odin",
+ "begin": "\\b(import|foreign\\s+import)\\b",
+ "beginCaptures": {"0": {"name": "keyword.control.import.odin"}},
+ "end": "(?=^|;)",
+ "patterns": [
+ { "name": "string.import.odin",
+ "match": "([\"`])([\\w\\.]*[/:])*([A-Za-z_]\\w*)([\"`])",
+ "captures": {
+ "1": {"name": "punctuation.definition.string.begin.odin"},
+ "3": {"name": "entity.name.namespace.odin"},
+ "4": {"name": "punctuation.definition.string.end.odin"}
+ }
+ },
+ { "name": "entity.name.alias.odin",
+ "begin": "\\b[A-Za-z_]\\w*",
+ "beginCaptures": {"0": {"name": "entity.name.namespace.odin"}},
+ "end": "(?=^|;)",
+ "patterns": [
+ { "include": "#strings" },
+ { "include": "#comments" }
+ ]
+ },
+ { "include": "#comments" }
+ ]
+ },
"map-bitset": {
"begin": "\\b(bit_set|map)\\b",
"beginCaptures": { "0": { "name": "storage.type.odin" } },