Skip to content

Commit

Permalink
Highlight module reference for export, import expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
zoodogood committed Nov 8, 2024
1 parent b1a4a4e commit 78bd2f7
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions lsp/syntaxes/civet.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,31 +166,34 @@
}
]
},

{
"name": "meta.import.civet",
"match": "(?:(import)\\s+(type)?\\s*)?(\\{(?:.|\\n)*\\}(?=\\s+from)|\\w+)\\s+(from)\\s+(\\S+)",
"captures": {
"1": { "name": "keyword.control.import.civet" },
"2": { "name": "keyword.control.type.civet" },
"3": {
"patterns": [
{"include": "source.civet"}
]
},
"4": { "name": "keyword.control.from.civet" },
"5": { "name": "string.unquoted.module-reference.civet" }
}
"name": "string.unquoted.module-reference.civet",
"match": "(?<=(^\\s*(import|export)|^)\\s*(type\\s+)?((\\w+\\s*,\\s*)?\\{(.|\\n)*\\}|\\w+|(\\*\\s+as\\s+\\w+))\\s+(from)\\s+)([^\\(\\{\\[\"';\\s=>][^\"';\\s=>]+|\".+?\"|'.+?')(?=[^()]|$)"
},
{
"name": "string.unquoted.module-reference.civet",
"match": "(?<=^\\s*from\\s+)([^\\(\\{\\[\"';\\s=>][^\"';\\s=>]+|\".+?\"|'.+?')(?=\\s+(import|export)\\s*[^()])"
},
{
"name": "string.unquoted.module-reference.civet",
"match": "(?<=^\\s*import\\s+)([^\\(\\{\\[\"';\\s=>][^\"';\\s=>]+|\".+?\"|'.+?')(?=\\s*$)"
},
{
"name": "string.unquoted.module-reference.civet",
"match": "(?<=^export\\s+(\\w+\\s*,?\\s*)+\\s+from\\s+)([^\\(\\{\\[\"';\\s=>][^\"';\\s=>]+|\".+?\"|'.+?')(?=[^()]|$)"
},

{
"match": "\\b(?<![\\.\\$])(break|by|case|catch|continue|else|finally|for|in|of|if|return|switch|then|throw|try|unless|when|while|until|loop|do|export|import|default|from|as|yield|async|await|with|(?<=for)\\s+own)(?!\\s*:)\\b",
"match": "\\b(?<![\\.\\$])(break|by|case|catch|continue|else|finally|for|in|of|if|return|switch|then|throw|try|unless|when|while|until|loop|do|export|import|default|from|as|yield|async|await|(?<=for)\\s+own)(?!\\s*:)\\b",
"name": "keyword.control.civet"
},
{
"match": "\\b(?<![\\.\\$])(delete|instanceof|new|typeof)(?!\\s*:)\\b",
"name": "keyword.operator.$1.civet"
},
{
"match": "\\b(?<![\\.\\$])(case|function|var|void|with|const|let|enum|native|__hasProp|__extends|__slice|__bind|__indexOf|implements|interface|package|private|protected|public|static)(?!\\s*:)\\b",
"match": "\\b(?<![\\.\\$])(case|function|var|void|with|const|let|enum|native|__hasProp|__extends|__slice|__bind|__indexOf|implements|interface|type|package|private|protected|public|static)(?!\\s*:)\\b",
"name": "keyword.reserved.civet"
},
{
Expand Down

0 comments on commit 78bd2f7

Please sign in to comment.