diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2024-04-20 19:34:32 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-20 19:34:32 +0200 |
| commit | 9147dc2f31f38148daaeebd083f7120bb8d6bab0 (patch) | |
| tree | 71724596c4bdda7429dd9940e5d51a64a43cbc56 | |
| parent | bbbc45299e7e367ce0bd4f60956cdf8eb8b8c3f6 (diff) | |
| parent | 668738c7158e48edd0d01a76131078029fa9ad9a (diff) | |
Merge pull request #362 from thetarnav/better-import-grammar
Highlight namespaces in import declarations
| -rw-r--r-- | editors/vscode/.npmrc | 1 | ||||
| -rw-r--r-- | editors/vscode/package-lock.json | 4 | ||||
| -rw-r--r-- | editors/vscode/syntaxes/odin.tmLanguage.json | 28 |
3 files changed, 31 insertions, 2 deletions
diff --git a/editors/vscode/.npmrc b/editors/vscode/.npmrc new file mode 100644 index 0000000..ec84bd8 --- /dev/null +++ b/editors/vscode/.npmrc @@ -0,0 +1 @@ +install-strategy=hoisted
\ No newline at end of file diff --git a/editors/vscode/package-lock.json b/editors/vscode/package-lock.json index 6d2309e..da86bd6 100644 --- a/editors/vscode/package-lock.json +++ b/editors/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "ols", - "version": "0.1.26", + "version": "0.1.27", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ols", - "version": "0.1.26", + "version": "0.1.27", "dependencies": { "adm-zip": "^0.5.9", "https-proxy-agent": "^5.0.0", diff --git a/editors/vscode/syntaxes/odin.tmLanguage.json b/editors/vscode/syntaxes/odin.tmLanguage.json index bd41c02..7f8ec14 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,33 @@ "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": "#strings"}, + {"include": "#comments"} + ] + }, "map-bitset": { "begin": "\\b(bit_set|map)\\b", "beginCaptures": { "0": { "name": "storage.type.odin" } }, |