From 33246e374868686bce6b7524e667b518de1dcb2b Mon Sep 17 00:00:00 2001 From: nefrob <25070989+nefrob@users.noreply.github.com> Date: Wed, 17 Jul 2024 06:49:16 -0700 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20`dir`=20shortening=20builtins?= =?UTF-8?q?=20from=20just=20release=201.31.0=20(#25)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add new builtins * Update CHANGELOG.md --- CHANGELOG.md | 4 ++ justfile | 2 +- syntaxes/just.tmLanguage.json | 2 +- syntaxes/just.tmLanguage.yml | 18 +++---- syntaxes/tests/general/builtins.just | 14 ++++++ syntaxes/tests/general/builtins.just.snap | 56 +++++++++++++++++++++ syntaxes/tests/variables/settings.just | 1 + syntaxes/tests/variables/settings.just.snap | 8 +++ 8 files changed, 94 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16dbb08..12cc910 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## [Unreleased] +### Added + +- New `dir` shortening of `directory` builtin functions from `just` release 1.31.0 + ## [0.5.0] - 2024-07-16 ### Added diff --git a/justfile b/justfile index 3703506..3e3f00f 100644 --- a/justfile +++ b/justfile @@ -7,7 +7,7 @@ build +ARGS="": test +ARGS="": docker compose run --rm dev /bin/sh -c \ - "yarn pretest {{ ARGS }}" + "yarn pretest" # TODO: setup xvfb for running tests in container/ci # docker compose run --rm dev /bin/sh -c \ # "xvfb-run -a yarn test-extension {{ ARGS }}" diff --git a/syntaxes/just.tmLanguage.json b/syntaxes/just.tmLanguage.json index 432ef8f..f61534b 100644 --- a/syntaxes/just.tmLanguage.json +++ b/syntaxes/just.tmLanguage.json @@ -213,7 +213,7 @@ "patterns": [ { "name": "support.function.builtin.just", - "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" + "match": "(?x) \\b(\n arch|num_cpus|os|os_family|shell|env_var|env_var_or_default|env|\n is_dependency|invocation_directory|invocation_dir|invocation_directory_native|\n invocation_dir_native|justfile|justfile_directory|justfile_dir|just_executable|\n just_pid|source_file|source_directory|source_dir|module_file|module_directory|\n module_dir|append|prepend|encode_uri_component|quote|replace|replace_regex|\n trim|trim_end|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|parent_dir|without_extension|clean|join|\n path_exists|error|assert|sha256|sha256_file|uuid|choose|datetime|\n datetime_utc|semver_matches|cache_directory|cache_dir|config_directory|config_dir|\n config_local_directory|config_local_dir|data_directory|data_dir|data_local_directory|\n data_local_dir|executable_directory|executable_dir|home_directory|home_dir\n)\\b\n" } ] }, diff --git a/syntaxes/just.tmLanguage.yml b/syntaxes/just.tmLanguage.yml index c15a3ff..57079ae 100644 --- a/syntaxes/just.tmLanguage.yml +++ b/syntaxes/just.tmLanguage.yml @@ -147,19 +147,19 @@ repository: match: | (?x) \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| + is_dependency|invocation_directory|invocation_dir|invocation_directory_native| + invocation_dir_native|justfile|justfile_directory|justfile_dir|just_executable| + just_pid|source_file|source_directory|source_dir|module_file|module_directory| + module_dir|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| + file_name|file_stem|parent_directory|parent_dir|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 + datetime_utc|semver_matches|cache_directory|cache_dir|config_directory|config_dir| + config_local_directory|config_local_dir|data_directory|data_dir|data_local_directory| + data_local_dir|executable_directory|executable_dir|home_directory|home_dir )\b literal: diff --git a/syntaxes/tests/general/builtins.just b/syntaxes/tests/general/builtins.just index 8fe3dbf..044aeff 100644 --- a/syntaxes/tests/general/builtins.just +++ b/syntaxes/tests/general/builtins.just @@ -38,11 +38,15 @@ is_dependency() # Invocation directory invocation_directory() +invocation_dir() +invocation_directory_native() +invocation_dir_native() # Just justfile() justfile_directory() +justfile_dir() just_executable() just_pid() @@ -50,8 +54,10 @@ just_pid() source_file() source_directory() +source_dir() module_file() module_directory() +module_dir() # Strings @@ -89,6 +95,7 @@ extension(path) file_name(path) file_stem(path) parent_directory(path) +parent_dir() without_extension(path) clean(path) @@ -117,9 +124,16 @@ datetime_utc(format) semver_matches(version, requirement) cache_directory() +cache_dir() config_directory() +config_dir() config_local_directory() +config_local_dir() data_directory() +data_dir() data_local_directory() +data_local_dir() executable_directory() +executable_dir() home_directory() +home_dir() diff --git a/syntaxes/tests/general/builtins.just.snap b/syntaxes/tests/general/builtins.just.snap index ccefe77..2262d90 100644 --- a/syntaxes/tests/general/builtins.just.snap +++ b/syntaxes/tests/general/builtins.just.snap @@ -91,6 +91,18 @@ #^^^^^^^^^^^^^^^^^^^^ source.just support.function.builtin.just # ^ source.just # ^ source.just +>invocation_dir() +#^^^^^^^^^^^^^^ source.just support.function.builtin.just +# ^ source.just +# ^ source.just +>invocation_directory_native() +#^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.just support.function.builtin.just +# ^ source.just +# ^ source.just +>invocation_dir_native() +#^^^^^^^^^^^^^^^^^^^^^ source.just support.function.builtin.just +# ^ source.just +# ^ source.just > ># Just #^^^^^^ source.just comment.line.number-sign.just @@ -103,6 +115,10 @@ #^^^^^^^^^^^^^^^^^^ source.just support.function.builtin.just # ^ source.just # ^ source.just +>justfile_dir() +#^^^^^^^^^^^^ source.just support.function.builtin.just +# ^ source.just +# ^ source.just >just_executable() #^^^^^^^^^^^^^^^ source.just support.function.builtin.just # ^ source.just @@ -123,6 +139,10 @@ #^^^^^^^^^^^^^^^^ source.just support.function.builtin.just # ^ source.just # ^ source.just +>source_dir() +#^^^^^^^^^^ source.just support.function.builtin.just +# ^ source.just +# ^ source.just >module_file() #^^^^^^^^^^^ source.just support.function.builtin.just # ^ source.just @@ -131,6 +151,10 @@ #^^^^^^^^^^^^^^^^ source.just support.function.builtin.just # ^ source.just # ^ source.just +>module_dir() +#^^^^^^^^^^ source.just support.function.builtin.just +# ^ source.just +# ^ source.just > > ># Strings @@ -289,6 +313,10 @@ # ^ source.just # ^^^^ source.just # ^ source.just +>parent_dir() +#^^^^^^^^^^ source.just support.function.builtin.just +# ^ source.just +# ^ source.just >without_extension(path) #^^^^^^^^^^^^^^^^^ source.just support.function.builtin.just # ^ source.just @@ -381,28 +409,56 @@ #^^^^^^^^^^^^^^^ source.just support.function.builtin.just # ^ source.just # ^ source.just +>cache_dir() +#^^^^^^^^^ source.just support.function.builtin.just +# ^ source.just +# ^ source.just >config_directory() #^^^^^^^^^^^^^^^^ source.just support.function.builtin.just # ^ source.just # ^ source.just +>config_dir() +#^^^^^^^^^^ source.just support.function.builtin.just +# ^ source.just +# ^ source.just >config_local_directory() #^^^^^^^^^^^^^^^^^^^^^^ source.just support.function.builtin.just # ^ source.just # ^ source.just +>config_local_dir() +#^^^^^^^^^^^^^^^^ source.just support.function.builtin.just +# ^ source.just +# ^ source.just >data_directory() #^^^^^^^^^^^^^^ source.just support.function.builtin.just # ^ source.just # ^ source.just +>data_dir() +#^^^^^^^^ source.just support.function.builtin.just +# ^ source.just +# ^ source.just >data_local_directory() #^^^^^^^^^^^^^^^^^^^^ source.just support.function.builtin.just # ^ source.just # ^ source.just +>data_local_dir() +#^^^^^^^^^^^^^^ source.just support.function.builtin.just +# ^ source.just +# ^ source.just >executable_directory() #^^^^^^^^^^^^^^^^^^^^ source.just support.function.builtin.just # ^ source.just # ^ source.just +>executable_dir() +#^^^^^^^^^^^^^^ source.just support.function.builtin.just +# ^ source.just +# ^ source.just >home_directory() #^^^^^^^^^^^^^^ source.just support.function.builtin.just # ^ source.just # ^ source.just +>home_dir() +#^^^^^^^^ source.just support.function.builtin.just +# ^ source.just +# ^ source.just > \ No newline at end of file diff --git a/syntaxes/tests/variables/settings.just b/syntaxes/tests/variables/settings.just index c7db1a4..0912253 100644 --- a/syntaxes/tests/variables/settings.just +++ b/syntaxes/tests/variables/settings.just @@ -14,6 +14,7 @@ set shell := ["bash", "-uc"] set tempdir := "/tmp" set windows-powershell := false set windows-shell := "cmd" +set unstable := true # Boolean not required diff --git a/syntaxes/tests/variables/settings.just.snap b/syntaxes/tests/variables/settings.just.snap index 52c1066..1d2429b 100644 --- a/syntaxes/tests/variables/settings.just.snap +++ b/syntaxes/tests/variables/settings.just.snap @@ -128,6 +128,14 @@ # ^ source.just string.quoted.double.just string.quoted.double.just # ^^^ source.just string.quoted.double.just # ^ source.just string.quoted.double.just +>set unstable := true +#^^^ source.just keyword.other.reserved.just +# ^ source.just +# ^^^^^^^^ source.just variable.other.just +# ^ source.just +# ^^ source.just keyword.operator.assignment.just +# ^ source.just +# ^^^^ source.just constant.language.boolean.just > ># Boolean not required #^^^^^^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just