diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a721dc..6f6996c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,10 +5,16 @@ ### Added - `HEX` constants +- Optional `?` operator for `import` and `mod` + +### Fixed + +- Backticks in recipe definitions now highlight correctly ### Changed - Updated tests +- Cleaned up inconsistent scope names for the same tokens ## [0.3.0] - 2024-06015 diff --git a/README.md b/README.md index 56c832c..ad8ac46 100644 --- a/README.md +++ b/README.md @@ -34,13 +34,36 @@ Note: Unlike previous iterations of VSCode `just` extensions, this extension doe This extension does simple and/or best effort syntax highlighting. It is not intended to be 100% comprehensive, but rather provide a good enough experience for most users. That being said, if you find a bug or missing feature, please open an issue or a pull request. -- Interpolation blocks, e.g. `{{ variable }}`, color all content as a string. Ideally it should match base `just` language highlighting, however limitations of regexs make comprehensive highlighting here complex or impossible for certain scenarios. -- This extension is not available on open source marketplaces (for now). If you are using an open source build of VSCode, you might need to install the extension manually. To do so: +#### Nesting and scoping - 1. Navigate to the latest [release](https://github.com/nefrob/vscode-just/releases) and download the `.vsix` file. - 2. Copy the file to your `.vscode/extensions` directory. - 3. Install via the command line: `code --install-extension .vscode/extensions/vscode-just-X.Y.Z.vsix` +Since expressions can have deep nesting and we cannot tell the scope based on indentation or other markers, we run into the following issues. These are limitations of TextMate grammars and is not easily fixable. + +- Expression and recipe specific rules pollute the global repository scopes, meaning we apply `just` highlighting within recipe bodies. This means `just` keywords/operators/etc, like `if`, will highlight everywhere. This is necessary to highlight expressions correctly elsewhere. + +- Some nested expressions will break due to lack of awareness of depth and preemptively match a closing character. Ex. + + ``` + echo {{ '{{ string }}' }} + ``` + + will echo `{{ string }}` since braces within the string are escaped and part of the string's scope. Textmate can't handle this without a full parser, so will match on the first closing brace it finds. + +- Line breaking and expressions that span multiple lines may not highlight correctly. As a simple example + + ``` + foo param1 \ + param2='foo': + echo {{param1}} {{param2}} + ``` + +#### Publishing + +This extension is not available on open source marketplaces (for now). If you are using an open source build of VSCode, you might need to install the extension manually. To do so: + +1. Navigate to the latest [release](https://github.com/nefrob/vscode-just/releases) and download the `.vsix` file. +2. Copy the file to your `.vscode/extensions` directory. +3. Install via the command line: `code --install-extension .vscode/extensions/vscode-just-X.Y.Z.vsix` ## Release Notes diff --git a/syntaxes/just.tmLanguage.json b/syntaxes/just.tmLanguage.json index dea99bb..432ef8f 100644 --- a/syntaxes/just.tmLanguage.json +++ b/syntaxes/just.tmLanguage.json @@ -7,40 +7,49 @@ "uuid": "8b0cfae0-229f-4688-a4b7-8b5c3db82855", "patterns": [ { - "include": "#assignment" + "include": "#comments" }, { - "include": "#comments" + "include": "#import" }, { - "include": "#constants" + "include": "#module" }, { - "include": "#keywords" + "include": "#alias" }, { - "include": "#operators" + "include": "#assignment" }, { "include": "#builtins" }, { - "include": "#backtick" + "include": "#keywords" }, { - "include": "#embedded-languages" + "include": "#expression-operators" + }, + { + "include": "#backtick" }, { "include": "#strings" }, { - "include": "#escaping" + "include": "#parenthesis" }, { "include": "#recipes" }, { - "include": "#parenthesis-block" + "include": "#recipe-operators" + }, + { + "include": "#embedded-languages" + }, + { + "include": "#escaping" } ], "repository": { @@ -52,128 +61,254 @@ } ] }, - "constants": { + "import": { + "begin": "(?x)\n ^\n (import)\n (\\?)? \\s+\n", + "end": "$", + "beginCaptures": { + "1": { + "name": "keyword.other.reserved.just" + }, + "2": { + "name": "punctuation.optional.just" + } + }, "patterns": [ { - "comment": "Boolean", - "name": "constant.language.boolean.just", - "match": "\\b(true|false)\\b" + "include": "#strings" + } + ] + }, + "module": { + "begin": "(?x)\n ^\n (mod)\n (\\?)? \\s+\n ([a-zA-Z_][a-zA-Z0-9_-]*)\n (?=[$\\s])\n", + "end": "$", + "beginCaptures": { + "1": { + "name": "keyword.other.reserved.just" + }, + "2": { + "name": "punctuation.optional.just" + }, + "3": { + "name": "variable.name.module.just" + } + }, + "patterns": [ + { + "include": "#strings" + } + ] + }, + "alias": { + "match": "(?x)\n ^\n (alias) \\s+ \n ([a-zA-Z_][a-zA-Z0-9_-]*) \\s* \n (:=) \\s* \n ([a-zA-Z_][a-zA-Z0-9_-]*)\n", + "captures": { + "1": { + "name": "keyword.other.reserved.just" }, + "2": { + "name": "variable.name.alias.just" + }, + "3": { + "name": "keyword.operator.assignment.just" + }, + "4": { + "name": "variable.other.just" + } + } + }, + "assignment": { + "patterns": [ { - "comment": "Integer", - "name": "constant.language.integer.just", - "match": "\\b\\d+\\b" + "include": "#variable-assignment" }, { - "comment": "Hex", - "name": "constant.language.hex.just", - "match": "\\b(HEX|HEXLOWER|HEXUPPER)\\b" + "include": "#setting-assignment" } ] }, - "keywords": { + "variable-assignment": { "patterns": [ { - "comment": "Reserved", - "match": "^(alias|export|import|mod|set)\\s+", - "captures": { + "begin": "(?x) \n ^\n (?: (export) \\s+)?\n ([a-zA-Z_][a-zA-Z0-9_-]*) \\s*\n (:=)\n", + "end": "$", + "beginCaptures": { "1": { "name": "keyword.other.reserved.just" + }, + "2": { + "name": "variable.other.just" + }, + "3": { + "name": "keyword.operator.assignment.just" } - } - }, + }, + "patterns": [ + { + "include": "#expression" + } + ] + } + ] + }, + "setting-assignment": { + "patterns": [ { - "comment": "Conditional", - "name": "keyword.control.conditional.just", - "match": "\\b(if|else)\\b" + "begin": "(?x) \n ^\n (set) \\s+\n ([a-zA-Z_][a-zA-Z0-9_-]*) \\s*\n (:=)?\n", + "end": "$", + "beginCaptures": { + "1": { + "name": "keyword.other.reserved.just" + }, + "2": { + "name": "variable.other.just" + }, + "3": { + "name": "keyword.operator.assignment.just" + } + }, + "patterns": [ + { + "include": "#expression" + } + ] } ] }, - "operators": { + "expression": { "patterns": [ { - "comment": "Path join", - "name": "keyword.operator.path-join.just", - "match": "\\/" + "include": "#backtick" }, { - "comment": "Concatenation", - "name": "keyword.operator.concat.just", - "match": "\\+" + "include": "#builtins" }, { - "comment": "And", - "name": "keyword.operator.and.just", - "match": "&&" + "include": "#control-keywords" }, { - "comment": "Equality", - "name": "keyword.operator.equality.just", - "match": "(\\=\\=|\\=\\~|\\!\\=)" + "include": "#expression-operators" }, { - "comment": "Quiet", - "match": "^\\s+(@)", - "captures": { - "1": { - "name": "keyword.operator.quiet.just" - } - } + "include": "#parenthesis" }, { - "comment": "Error suppression", - "match": "^\\s+(\\-)", - "captures": { - "1": { - "name": "keyword.operator.error-suppression.just" - } - } + "include": "#strings" } ] }, "builtins": { "patterns": [ { - "commment": "Functions", + "name": "constant.language.hex.just", + "match": "\\b(HEX|HEXLOWER|HEXUPPER)\\b" + }, + { + "include": "#builtin-functions" + }, + { + "include": "#literal" + } + ] + }, + "builtin-functions": { + "patterns": [ + { "name": "support.function.builtin.just", - "match": "\\b(arch|num_cpus|os|os_family|shell|env_var|env_var_or_default|env|is_dependency|invocation_directory|invocation_directory_native|justfile|justfile_directory|just_executable|just_pid|source_file|source_directory|module_file|module_directory|append|prepend|encode_uri_component|quote|replace|replace_regex|trim|trim_end|trim_end_match|trim_end_matches|trim_start|trim_start_match|trim_start_matches|capitalize|kebabcase|lowercamelcase|lowercase|shoutykebabcase|shoutysnakecase|snakecase|titlecase|uppercamelcase|uppercase|absolute_path|blake3|blake3_file|canonicalize|extension|file_name|file_stem|parent_directory|without_extension|clean|join|path_exists|error|assert|sha256|sha256_file|uuid|choose|datetime|datetime_utc|semver_matches|cache_directory|config_directory|config_local_directory|data_directory|data_local_directory|executable_directory|home_directory)\\b" + "match": "(?x) \\b(\n arch|num_cpus|os|os_family|shell|env_var|env_var_or_default|env|\n is_dependency|invocation_directory|invocation_directory_native|\n justfile|justfile_directory|just_executable|just_pid|source_file|\n source_directory|module_file|module_directory|append|prepend|\n encode_uri_component|quote|replace|replace_regex|trim|trim_end|\n trim_end_match|trim_end_matches|trim_start|trim_start_match|\n trim_start_matches|capitalize|kebabcase|lowercamelcase|lowercase|\n shoutykebabcase|shoutysnakecase|snakecase|titlecase|uppercamelcase|\n uppercase|absolute_path|blake3|blake3_file|canonicalize|extension|\n file_name|file_stem|parent_directory|without_extension|clean|join|\n path_exists|error|assert|sha256|sha256_file|uuid|choose|datetime|\n datetime_utc|semver_matches|cache_directory|config_directory|\n config_local_directory|data_directory|data_local_directory|\n executable_directory|home_directory\n)\\b\n" } ] }, - "assignment": { + "literal": { "patterns": [ { - "comment": "Variable", - "match": "^(?:(alias|export)\\s+)?([a-zA-Z_][a-zA-Z0-9_-]*)\\s*(:=)", - "captures": { - "1": { - "name": "keyword.other.assignment.just" - }, - "2": { - "name": "variable.other.just" - }, - "3": { - "name": "keyword.operator.assignment.just" - } - } + "include": "#boolean" }, { - "comment": "Setting", - "match": "^(set)\\s+([a-zA-Z_][a-zA-Z0-9_-]*)\\s*(:=)?", + "include": "#number" + } + ] + }, + "boolean": { + "patterns": [ + { + "name": "constant.language.boolean.just", + "match": "\\b(true|false)\\b" + } + ] + }, + "number": { + "patterns": [ + { + "name": "constant.numeric.just", + "match": "(?x)\n (? echo foo #^^^^^^^^^^^^^ source.just > echo bar diff --git a/tests/general/builtins.just b/tests/general/builtins.just index 7676fd9..8fe3dbf 100644 --- a/tests/general/builtins.just +++ b/tests/general/builtins.just @@ -1,4 +1,4 @@ -# Builin keywords +# Reserved keywords alias set @@ -13,8 +13,6 @@ else # Builtin functions -# TODO: should parentheses be optional or required? - # System info arch() diff --git a/tests/general/builtins.just.snap b/tests/general/builtins.just.snap index 87cb624..ccefe77 100644 --- a/tests/general/builtins.just.snap +++ b/tests/general/builtins.just.snap @@ -1,5 +1,5 @@ -># Builin keywords -#^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just +># Reserved keywords +#^^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just > >alias #^^^^^ source.just keyword.other.reserved.just @@ -23,24 +23,25 @@ ># Builtin functions #^^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just > -># TODO: should parentheses be optional or required? -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just -> ># System info #^^^^^^^^^^^^^ source.just comment.line.number-sign.just > >arch() #^^^^ source.just support.function.builtin.just -# ^^ source.just +# ^ source.just +# ^ source.just >num_cpus() #^^^^^^^^ source.just support.function.builtin.just -# ^^ source.just +# ^ source.just +# ^ source.just >os() #^^ source.just support.function.builtin.just -# ^^ source.just +# ^ source.just +# ^ source.just >os_family() #^^^^^^^^^ source.just support.function.builtin.just -# ^^ source.just +# ^ source.just +# ^ source.just > ># External commands #^^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just @@ -80,46 +81,56 @@ > >is_dependency() #^^^^^^^^^^^^^ source.just support.function.builtin.just -# ^^ source.just +# ^ source.just +# ^ source.just > ># Invocation directory #^^^^^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just > >invocation_directory() #^^^^^^^^^^^^^^^^^^^^ source.just support.function.builtin.just -# ^^ source.just +# ^ source.just +# ^ source.just > ># Just #^^^^^^ source.just comment.line.number-sign.just > >justfile() #^^^^^^^^ source.just support.function.builtin.just -# ^^ source.just +# ^ source.just +# ^ source.just >justfile_directory() #^^^^^^^^^^^^^^^^^^ source.just support.function.builtin.just -# ^^ source.just +# ^ source.just +# ^ source.just >just_executable() #^^^^^^^^^^^^^^^ source.just support.function.builtin.just -# ^^ source.just +# ^ source.just +# ^ source.just >just_pid() #^^^^^^^^ source.just support.function.builtin.just -# ^^ source.just +# ^ source.just +# ^ source.just > ># Source #^^^^^^^^ source.just comment.line.number-sign.just > >source_file() #^^^^^^^^^^^ source.just support.function.builtin.just -# ^^ source.just +# ^ source.just +# ^ source.just >source_directory() #^^^^^^^^^^^^^^^^ source.just support.function.builtin.just -# ^^ source.just +# ^ source.just +# ^ source.just >module_file() #^^^^^^^^^^^ source.just support.function.builtin.just -# ^^ source.just +# ^ source.just +# ^ source.just >module_directory() #^^^^^^^^^^^^^^^^ source.just support.function.builtin.just -# ^^ source.just +# ^ source.just +# ^ source.just > > ># Strings @@ -340,7 +351,8 @@ # ^ source.just >uuid() #^^^^ source.just support.function.builtin.just -# ^^ source.just +# ^ source.just +# ^ source.just > >choose(n, alphabet) #^^^^^^ source.just support.function.builtin.just @@ -367,23 +379,30 @@ > >cache_directory() #^^^^^^^^^^^^^^^ source.just support.function.builtin.just -# ^^ source.just +# ^ source.just +# ^ source.just >config_directory() #^^^^^^^^^^^^^^^^ source.just support.function.builtin.just -# ^^ source.just +# ^ source.just +# ^ source.just >config_local_directory() #^^^^^^^^^^^^^^^^^^^^^^ source.just support.function.builtin.just -# ^^ source.just +# ^ source.just +# ^ source.just >data_directory() #^^^^^^^^^^^^^^ source.just support.function.builtin.just -# ^^ source.just +# ^ source.just +# ^ source.just >data_local_directory() #^^^^^^^^^^^^^^^^^^^^ source.just support.function.builtin.just -# ^^ source.just +# ^ source.just +# ^ source.just >executable_directory() #^^^^^^^^^^^^^^^^^^^^ source.just support.function.builtin.just -# ^^ source.just +# ^ source.just +# ^ source.just >home_directory() #^^^^^^^^^^^^^^ source.just support.function.builtin.just -# ^^ source.just +# ^ source.just +# ^ source.just > \ No newline at end of file diff --git a/tests/general/constants.just b/tests/general/constants.just index 1273a82..39f002f 100644 --- a/tests/general/constants.just +++ b/tests/general/constants.just @@ -3,6 +3,12 @@ true false +1234 +1234. +12.34 +0.1234 +.1234 + HEX HEXLOWER HEXUPPER diff --git a/tests/general/constants.just.snap b/tests/general/constants.just.snap index 41af3df..3379c26 100644 --- a/tests/general/constants.just.snap +++ b/tests/general/constants.just.snap @@ -6,6 +6,17 @@ >false #^^^^^ source.just constant.language.boolean.just > +>1234 +#^^^^ source.just constant.numeric.just +>1234. +#^^^^^ source.just constant.numeric.just +>12.34 +#^^^^^ source.just constant.numeric.just +>0.1234 +#^^^^^^ source.just constant.numeric.just +>.1234 +#^^^^^ source.just constant.numeric.just +> >HEX #^^^ source.just constant.language.hex.just >HEXLOWER diff --git a/tests/general/general.just b/tests/general/general.just index aad52d9..3c06cb4 100644 --- a/tests/general/general.just +++ b/tests/general/general.just @@ -4,14 +4,11 @@ something # Comment after code -# Numbers - -123 -# TODO: should the "." be colored differently? -123.456 - # Imports import 'foo/bar.just' +import? 'foo/bar.just' mod bar +mod? bar +mod bar 'foo/bar.just' diff --git a/tests/general/general.just.snap b/tests/general/general.just.snap index be28f7a..ddfbe6a 100644 --- a/tests/general/general.just.snap +++ b/tests/general/general.just.snap @@ -8,18 +8,6 @@ #^^^^^^^^^^ source.just # ^^^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just > -># Numbers -#^^^^^^^^^ source.just comment.line.number-sign.just -> ->123 -#^^^ source.just constant.language.integer.just -># TODO: should the "." be colored differently? -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just ->123.456 -#^^^ source.just constant.language.integer.just -# ^ source.just -# ^^^ source.just constant.language.integer.just -> ># Imports #^^^^^^^^^ source.just comment.line.number-sign.just > @@ -29,9 +17,29 @@ # ^ source.just string.quoted.single.just string.quoted.single.just # ^^^^^^^^^^^^ source.just string.quoted.single.just # ^ source.just string.quoted.single.just +>import? 'foo/bar.just' +#^^^^^^ source.just keyword.other.reserved.just +# ^ source.just punctuation.optional.just +# ^ source.just +# ^ source.just string.quoted.single.just string.quoted.single.just +# ^^^^^^^^^^^^ source.just string.quoted.single.just +# ^ source.just string.quoted.single.just > >mod bar #^^^ source.just keyword.other.reserved.just # ^ source.just -# ^^^^ source.just +# ^^^ source.just variable.name.module.just +>mod? bar +#^^^ source.just keyword.other.reserved.just +# ^ source.just punctuation.optional.just +# ^ source.just +# ^^^ source.just variable.name.module.just +>mod bar 'foo/bar.just' +#^^^ source.just keyword.other.reserved.just +# ^ source.just +# ^^^ source.just variable.name.module.just +# ^ source.just +# ^ source.just string.quoted.single.just string.quoted.single.just +# ^^^^^^^^^^^^ source.just string.quoted.single.just +# ^ source.just string.quoted.single.just > \ No newline at end of file diff --git a/tests/general/multi-line-constructs.just b/tests/general/multi-line-constructs.just index c887e53..36d4874 100644 --- a/tests/general/multi-line-constructs.just +++ b/tests/general/multi-line-constructs.just @@ -1,9 +1,5 @@ # Multi-line constructs -# TODO: do we need to validate this? -# TODO: should just-specific highlighting in recipes be conditional (ex. only in interpolation blocks) -# or always on? - multi-line-recipe: if true; then \ echo 'True!'; \ @@ -22,7 +18,7 @@ abc2 := ( 'c' ) -# TODO: multi-line recipe def broken +# TODO: multi-line recipe def not supported foo param=('foo' + 'bar' diff --git a/tests/general/multi-line-constructs.just.snap b/tests/general/multi-line-constructs.just.snap index 82593bc..9700648 100644 --- a/tests/general/multi-line-constructs.just.snap +++ b/tests/general/multi-line-constructs.just.snap @@ -1,13 +1,6 @@ ># Multi-line constructs #^^^^^^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just > -># TODO: do we need to validate this? -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just -># TODO: should just-specific highlighting in recipes be conditional (ex. only in interpolation blocks) -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just -># or always on? -#^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just -> >multi-line-recipe: #^^^^^^^^^^^^^^^^^ source.just entity.name.function.just # ^ source.just keyword.operator.recipe.end.just @@ -34,7 +27,8 @@ #^^^ source.just variable.other.just # ^ source.just # ^^ source.just keyword.operator.assignment.just -# ^^ source.just +# ^ source.just +# ^ source.just # ^ source.just string.quoted.single.just string.quoted.single.just # ^ source.just string.quoted.single.just # ^ source.just string.quoted.single.just @@ -52,13 +46,14 @@ # ^ source.just string.quoted.single.just string.quoted.single.just # ^ source.just string.quoted.single.just # ^ source.just string.quoted.single.just -# ^^ source.just +# ^ source.just > >abc2 := ( #^^^^ source.just variable.other.just # ^ source.just # ^^ source.just keyword.operator.assignment.just -# ^^^ source.just +# ^ source.just +# ^ source.just > 'a' + #^^ source.just # ^ source.just string.quoted.single.just string.quoted.single.just @@ -79,13 +74,14 @@ # ^ source.just string.quoted.single.just # ^ source.just string.quoted.single.just >) -#^^ source.just +#^ source.just > -># TODO: multi-line recipe def broken -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just +># TODO: multi-line recipe def not supported +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just > >foo param=('foo' -#^^^^^^^^^^^ source.just +#^^^^^^^^^^ source.just +# ^ source.just # ^ source.just string.quoted.single.just string.quoted.single.just # ^^^ source.just string.quoted.single.just # ^ source.just string.quoted.single.just @@ -97,7 +93,9 @@ # ^^^ source.just string.quoted.single.just # ^ source.just string.quoted.single.just > ): -#^^^^^^^ source.just +#^^^^ source.just +# ^ source.just +# ^^ source.just > echo {{param}} #^^^^^^^ source.just # ^^ source.just string.interpolated.escaping.just string.interpolated.escape.just @@ -135,7 +133,7 @@ # ^ source.just string.quoted.single.just # ^ source.just # ^ source.just keyword.operator.concat.just -# ^^^ source.just +# ^^ source.just > 'bar' #^^^^^ source.just # ^ source.just string.quoted.single.just string.quoted.single.just diff --git a/tests/recipes/recipe-content.just b/tests/recipes/recipe-content.just index 8a656b2..fe95760 100644 --- a/tests/recipes/recipe-content.just +++ b/tests/recipes/recipe-content.just @@ -7,11 +7,5 @@ _private: echo hello body: - -echo "supress error" + -echo "suppress error" @echo quiet - -# Variables in recipes illegal - -# TODO: not implemented -# foo: -# x := "hello" \ No newline at end of file diff --git a/tests/recipes/recipe-content.just.snap b/tests/recipes/recipe-content.just.snap index 90c82f2..9f78451 100644 --- a/tests/recipes/recipe-content.just.snap +++ b/tests/recipes/recipe-content.just.snap @@ -18,24 +18,15 @@ >body: #^^^^ source.just entity.name.function.just # ^ source.just keyword.operator.recipe.end.just -> -echo "supress error" +> -echo "suppress error" #^^ source.just # ^ source.just keyword.operator.error-suppression.just # ^^^^^ source.just # ^ source.just string.quoted.double.just string.quoted.double.just -# ^^^^^^^^^^^^^ source.just string.quoted.double.just -# ^ source.just string.quoted.double.just +# ^^^^^^^^^^^^^^ source.just string.quoted.double.just +# ^ source.just string.quoted.double.just > @echo quiet #^^ source.just # ^ source.just keyword.operator.quiet.just # ^^^^^^^^^^^ source.just -> -># Variables in recipes illegal -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just -> -># TODO: not implemented -#^^^^^^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just -># foo: -#^^^^^^ source.just comment.line.number-sign.just -># x := "hello" -#^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just \ No newline at end of file +> \ No newline at end of file diff --git a/tests/recipes/recipe-definition.just b/tests/recipes/recipe-definition.just index 501404d..946c69c 100644 --- a/tests/recipes/recipe-definition.just +++ b/tests/recipes/recipe-definition.just @@ -27,7 +27,6 @@ default_value a=("a" + ("b" + "c")): foo a=(arch + "-unknown-unknown") b=(arch / "input.dat"): echo {{a}} {{b}} -# TODO: backticks broken a $A $B=`echo $A`: echo $A $B diff --git a/tests/recipes/recipe-definition.just.snap b/tests/recipes/recipe-definition.just.snap index d6b77cf..932e311 100644 --- a/tests/recipes/recipe-definition.just.snap +++ b/tests/recipes/recipe-definition.just.snap @@ -91,7 +91,8 @@ # ^ source.just string.quoted.double.just # ^ source.just # ^ source.just keyword.operator.concat.just -# ^^ source.just +# ^ source.just +# ^ source.just # ^ source.just string.quoted.double.just string.quoted.double.just # ^ source.just string.quoted.double.just # ^ source.just string.quoted.double.just @@ -147,8 +148,6 @@ # ^ source.just string.interpolated.escaping.just # ^^ source.just string.interpolated.escaping.just string.interpolated.escape.just > -># TODO: backticks broken -#^^^^^^^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just >a $A $B=`echo $A`: #^ source.just entity.name.function.just # ^ source.just @@ -158,7 +157,9 @@ # ^ source.just keyword.other.recipe.variadic.just # ^ source.just variable.parameter.recipe.just # ^ source.just keyword.operator.default.just -# ^^^^^^^^^ source.just +# ^ source.just string.interpolated.just +# ^^^^^^^ source.just source.shell +# ^ source.just string.interpolated.just # ^ source.just keyword.operator.recipe.end.just > echo $A $B #^^^^^^^^^^^^^ source.just @@ -250,13 +251,15 @@ # ^ source.just # ^ source.just # ^^^^^ source.just entity.name.function.just -# ^^ source.just +# ^ source.just +# ^ source.just # ^ source.just string.quoted.double.just string.quoted.double.just # ^ source.just string.quoted.double.just # ^ source.just string.quoted.double.just # ^ source.just # ^ source.just keyword.operator.concat.just -# ^^ source.just +# ^ source.just +# ^ source.just # ^ source.just string.quoted.double.just string.quoted.double.just # ^ source.just string.quoted.double.just # ^ source.just string.quoted.double.just diff --git a/tests/statements/conditionals.just.snap b/tests/statements/conditionals.just.snap index b049727..a5a9fb7 100644 --- a/tests/statements/conditionals.just.snap +++ b/tests/statements/conditionals.just.snap @@ -27,7 +27,7 @@ # ^ source.just string.quoted.double.just string.quoted.double.just # ^^^^ source.just string.quoted.double.just # ^ source.just string.quoted.double.just -# ^^^ source.just +# ^^ source.just >foo := if "hello" != "goodbye" { "xyz" } else { "abc" } #^^^ source.just variable.other.just # ^ source.just @@ -54,7 +54,7 @@ # ^ source.just string.quoted.double.just string.quoted.double.just # ^^^ source.just string.quoted.double.just # ^ source.just string.quoted.double.just -# ^^^ source.just +# ^^ source.just >foo := if "hello" =~ 'hel+o' { "match" } else { "mismatch" } #^^^ source.just variable.other.just # ^ source.just @@ -81,7 +81,7 @@ # ^ source.just string.quoted.double.just string.quoted.double.just # ^^^^^^^^ source.just string.quoted.double.just # ^ source.just string.quoted.double.just -# ^^^ source.just +# ^^ source.just >foo := if env_var("RELEASE") == "true" { `get-something-from-release-database` } else { "dummy-value" } #^^^ source.just variable.other.just # ^ source.just @@ -111,7 +111,7 @@ # ^ source.just string.quoted.double.just string.quoted.double.just # ^^^^^^^^^^^ source.just string.quoted.double.just # ^ source.just string.quoted.double.just -# ^^^ source.just +# ^^ source.just >foo := if "hello" == "goodbye" { #^^^ source.just variable.other.just # ^ source.just @@ -128,7 +128,7 @@ # ^ source.just string.quoted.double.just string.quoted.double.just # ^^^^^^^ source.just string.quoted.double.just # ^ source.just string.quoted.double.just -# ^^^ source.just +# ^^ source.just > "xyz" #^^ source.just # ^ source.just string.quoted.double.just string.quoted.double.just diff --git a/tests/statements/interpolation.just b/tests/statements/interpolation.just index a2986dd..bf64311 100644 --- a/tests/statements/interpolation.just +++ b/tests/statements/interpolation.just @@ -1,6 +1,7 @@ # Interpolation blocks -# TODO: interpolation blocks don't really work highlighting-wise +# TODO: interpolation blocks always color as strings since we can't +# effectively push scope for nested string/escape blocks base: echo {{var}} {{ var }} @@ -20,7 +21,7 @@ escaped: echo '{{ "{{" }} var }}' echo {{ "{{" }} var }} echo '{{'{{ var }}'}}' - # TODO: broken + # TODO: broken nesting # echo {{ '{{ var }}' }} # echo {{ "{{ var" }} }} # echo {{ "{{ 'var' }}" }} diff --git a/tests/statements/interpolation.just.snap b/tests/statements/interpolation.just.snap index 485ad65..3b697f0 100644 --- a/tests/statements/interpolation.just.snap +++ b/tests/statements/interpolation.just.snap @@ -1,8 +1,10 @@ ># Interpolation blocks #^^^^^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just > -># TODO: interpolation blocks don't really work highlighting-wise -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just +># TODO: interpolation blocks always color as strings since we can't +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just +># effectively push scope for nested string/escape blocks +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just > >base: #^^^^ source.just entity.name.function.just @@ -126,9 +128,9 @@ # ^ source.just string.quoted.single.just string.quoted.single.just # ^^ source.just string.quoted.single.just # ^ source.just string.quoted.single.just -> # TODO: broken +> # TODO: broken nesting #^^ source.just -# ^^^^^^^^^^^^^^ source.just comment.line.number-sign.just +# ^^^^^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just > # echo {{ '{{ var }}' }} #^^ source.just # ^^^^^^^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just diff --git a/tests/variables/settings.just.snap b/tests/variables/settings.just.snap index aaea81f..52c1066 100644 --- a/tests/variables/settings.just.snap +++ b/tests/variables/settings.just.snap @@ -4,7 +4,7 @@ >set allow-duplicate-recipes := true #^^^ source.just keyword.other.reserved.just # ^ source.just -# ^^^^^^^^^^^^^^^^^^^^^^^ source.just variable.language.setting.just +# ^^^^^^^^^^^^^^^^^^^^^^^ source.just variable.other.just # ^ source.just # ^^ source.just keyword.operator.assignment.just # ^ source.just @@ -12,7 +12,7 @@ >set allow-duplicate-variables := true #^^^ source.just keyword.other.reserved.just # ^ source.just -# ^^^^^^^^^^^^^^^^^^^^^^^^^ source.just variable.language.setting.just +# ^^^^^^^^^^^^^^^^^^^^^^^^^ source.just variable.other.just # ^ source.just # ^^ source.just keyword.operator.assignment.just # ^ source.just @@ -20,7 +20,7 @@ >set dotenv-filename := ".env" #^^^ source.just keyword.other.reserved.just # ^ source.just -# ^^^^^^^^^^^^^^^ source.just variable.language.setting.just +# ^^^^^^^^^^^^^^^ source.just variable.other.just # ^ source.just # ^^ source.just keyword.operator.assignment.just # ^ source.just @@ -30,7 +30,7 @@ >set dotenv-load := true #^^^ source.just keyword.other.reserved.just # ^ source.just -# ^^^^^^^^^^^ source.just variable.language.setting.just +# ^^^^^^^^^^^ source.just variable.other.just # ^ source.just # ^^ source.just keyword.operator.assignment.just # ^ source.just @@ -38,7 +38,7 @@ >set dotenv-path := "." #^^^ source.just keyword.other.reserved.just # ^ source.just -# ^^^^^^^^^^^ source.just variable.language.setting.just +# ^^^^^^^^^^^ source.just variable.other.just # ^ source.just # ^^ source.just keyword.operator.assignment.just # ^ source.just @@ -48,7 +48,7 @@ >set dotenv-required := false #^^^ source.just keyword.other.reserved.just # ^ source.just -# ^^^^^^^^^^^^^^^ source.just variable.language.setting.just +# ^^^^^^^^^^^^^^^ source.just variable.other.just # ^ source.just # ^^ source.just keyword.operator.assignment.just # ^ source.just @@ -56,7 +56,7 @@ >set export := true #^^^ source.just keyword.other.reserved.just # ^ source.just -# ^^^^^^ source.just variable.language.setting.just +# ^^^^^^ source.just variable.other.just # ^ source.just # ^^ source.just keyword.operator.assignment.just # ^ source.just @@ -64,7 +64,7 @@ >set fallback := true #^^^ source.just keyword.other.reserved.just # ^ source.just -# ^^^^^^^^ source.just variable.language.setting.just +# ^^^^^^^^ source.just variable.other.just # ^ source.just # ^^ source.just keyword.operator.assignment.just # ^ source.just @@ -72,7 +72,7 @@ >set ignore-comments := false #^^^ source.just keyword.other.reserved.just # ^ source.just -# ^^^^^^^^^^^^^^^ source.just variable.language.setting.just +# ^^^^^^^^^^^^^^^ source.just variable.other.just # ^ source.just # ^^ source.just keyword.operator.assignment.just # ^ source.just @@ -80,7 +80,7 @@ >set positional-arguments := true #^^^ source.just keyword.other.reserved.just # ^ source.just -# ^^^^^^^^^^^^^^^^^^^^ source.just variable.language.setting.just +# ^^^^^^^^^^^^^^^^^^^^ source.just variable.other.just # ^ source.just # ^^ source.just keyword.operator.assignment.just # ^ source.just @@ -88,7 +88,7 @@ >set shell := ["bash", "-uc"] #^^^ source.just keyword.other.reserved.just # ^ source.just -# ^^^^^ source.just variable.language.setting.just +# ^^^^^ source.just variable.other.just # ^ source.just # ^^ source.just keyword.operator.assignment.just # ^^ source.just @@ -99,11 +99,11 @@ # ^ source.just string.quoted.double.just string.quoted.double.just # ^^^ source.just string.quoted.double.just # ^ source.just string.quoted.double.just -# ^^ source.just +# ^ source.just >set tempdir := "/tmp" #^^^ source.just keyword.other.reserved.just # ^ source.just -# ^^^^^^^ source.just variable.language.setting.just +# ^^^^^^^ source.just variable.other.just # ^ source.just # ^^ source.just keyword.operator.assignment.just # ^ source.just @@ -113,7 +113,7 @@ >set windows-powershell := false #^^^ source.just keyword.other.reserved.just # ^ source.just -# ^^^^^^^^^^^^^^^^^^ source.just variable.language.setting.just +# ^^^^^^^^^^^^^^^^^^ source.just variable.other.just # ^ source.just # ^^ source.just keyword.operator.assignment.just # ^ source.just @@ -121,7 +121,7 @@ >set windows-shell := "cmd" #^^^ source.just keyword.other.reserved.just # ^ source.just -# ^^^^^^^^^^^^^ source.just variable.language.setting.just +# ^^^^^^^^^^^^^ source.just variable.other.just # ^ source.just # ^^ source.just keyword.operator.assignment.just # ^ source.just @@ -135,5 +135,5 @@ >set allow-duplicate-recipes #^^^ source.just keyword.other.reserved.just # ^ source.just -# ^^^^^^^^^^^^^^^^^^^^^^^ source.just variable.language.setting.just +# ^^^^^^^^^^^^^^^^^^^^^^^ source.just variable.other.just > \ No newline at end of file diff --git a/tests/variables/variables.just.snap b/tests/variables/variables.just.snap index 6f39c4c..6ccfc5d 100644 --- a/tests/variables/variables.just.snap +++ b/tests/variables/variables.just.snap @@ -3,19 +3,21 @@ #^^^^^^^^^ source.just comment.line.number-sign.just > >alias b := build -#^^^^^ source.just keyword.other.assignment.just +#^^^^^ source.just keyword.other.reserved.just # ^ source.just -# ^ source.just variable.other.just +# ^ source.just variable.name.alias.just # ^ source.just # ^^ source.just keyword.operator.assignment.just -# ^^^^^^^ source.just +# ^ source.just +# ^^^^^ source.just variable.other.just >alias help-123 := some-recipe -#^^^^^ source.just keyword.other.assignment.just +#^^^^^ source.just keyword.other.reserved.just # ^ source.just -# ^^^^^^^^ source.just variable.other.just +# ^^^^^^^^ source.just variable.name.alias.just # ^ source.just # ^^ source.just keyword.operator.assignment.just -# ^^^^^^^^^^^^^ source.just +# ^ source.just +# ^^^^^^^^^^^ source.just variable.other.just > ># Variables and substitution #^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just @@ -48,7 +50,7 @@ # ^ source.just string.quoted.double.just # ^ source.just # ^ source.just keyword.operator.concat.just -# ^^^^^^^^^ source.just +# ^^^^^^^^ source.just >tarball := tardir + ".tar.gz" #^^^^^^^ source.just variable.other.just # ^ source.just @@ -83,7 +85,7 @@ #^^^^^^^^^ source.just comment.line.number-sign.just > >export RUST_BACKTRACE := "1" -#^^^^^^ source.just keyword.other.assignment.just +#^^^^^^ source.just keyword.other.reserved.just # ^ source.just # ^^^^^^^^^^^^^^ source.just variable.other.just # ^ source.just