Skip to content

Commit

Permalink
✨ Add dir shortening builtins from just release 1.31.0 (#25)
Browse files Browse the repository at this point in the history
* feat: add new builtins

* Update CHANGELOG.md
  • Loading branch information
nefrob authored Jul 17, 2024
1 parent 30d67ab commit 33246e3
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand Down
2 changes: 1 addition & 1 deletion syntaxes/just.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
},
Expand Down
18 changes: 9 additions & 9 deletions syntaxes/just.tmLanguage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
14 changes: 14 additions & 0 deletions syntaxes/tests/general/builtins.just
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,26 @@ is_dependency()
# Invocation directory

invocation_directory()
invocation_dir()
invocation_directory_native()
invocation_dir_native()

# Just

justfile()
justfile_directory()
justfile_dir()
just_executable()
just_pid()

# Source

source_file()
source_directory()
source_dir()
module_file()
module_directory()
module_dir()


# Strings
Expand Down Expand Up @@ -89,6 +95,7 @@ extension(path)
file_name(path)
file_stem(path)
parent_directory(path)
parent_dir()
without_extension(path)

clean(path)
Expand Down Expand Up @@ -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()
56 changes: 56 additions & 0 deletions syntaxes/tests/general/builtins.just.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
>
1 change: 1 addition & 0 deletions syntaxes/tests/variables/settings.just
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 8 additions & 0 deletions syntaxes/tests/variables/settings.just.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 33246e3

Please sign in to comment.