diff options
| author | Damian Tarnawski <gthetarnav@gmail.com> | 2024-04-20 13:11:04 +0200 |
|---|---|---|
| committer | Damian Tarnawski <gthetarnav@gmail.com> | 2024-04-20 13:11:04 +0200 |
| commit | 5dadffc771754be293f3e5c8c4e7701ea2fde548 (patch) | |
| tree | f051050b803d85f7284dc458a90e390280aeef22 | |
| parent | ba538e8c2e92edbda1d7f4083e7685541efd8419 (diff) | |
Add improved grammars for import declarations
highlights namespace that the import provides
| -rw-r--r-- | editors/vscode/syntaxes/odin.tmLanguage.json | 27 |
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" } }, |