├── .gitignore ├── extension.toml ├── languages └── just │ ├── config.toml │ ├── folds.scm │ ├── highlights.scm │ ├── indents.scm │ ├── injections.scm │ ├── locals.scm │ ├── outline.scm │ ├── runnables.scm │ ├── tasks.json │ └── textobjects.scm └── tests ├── foo.just ├── foo.justfile ├── just └── justfile /.gitignore: -------------------------------------------------------------------------------- 1 | /grammars/* 2 | justfile 3 | !tests/justfile 4 | .DS_Store 5 | -------------------------------------------------------------------------------- /extension.toml: -------------------------------------------------------------------------------- 1 | id = "just" 2 | name = "Justfile" 3 | description = "Justfile syntax highlighting" 4 | version = "0.1.4" 5 | schema_version = 1 6 | authors = ["Jack T. "] 7 | repository = "https://github.com/jackTabsCode/zed-just" 8 | 9 | [grammars.just] 10 | repository = "https://github.com/IndianBoy42/tree-sitter-just" 11 | commit = "3f90d24eb8c8d9e8c74fee7120d79c3ec7229f26" 12 | -------------------------------------------------------------------------------- /languages/just/config.toml: -------------------------------------------------------------------------------- 1 | name = "Just" 2 | grammar = "just" 3 | path_suffixes = ["justfile", "Justfile", "JUSTFILE", "just"] 4 | line_comments = ["# "] 5 | brackets = [{ start = "(", end = ")", close = true, newline = true }] 6 | -------------------------------------------------------------------------------- /languages/just/folds.scm: -------------------------------------------------------------------------------- 1 | ; File autogenerated by build-queries-nvim.py; do not edit 2 | 3 | ; Define collapse points 4 | 5 | ([ 6 | (recipe) 7 | (string) 8 | (external_command) 9 | ] @fold 10 | (#trim! @fold)) 11 | -------------------------------------------------------------------------------- /languages/just/highlights.scm: -------------------------------------------------------------------------------- 1 | ; File autogenerated by build-queries-nvim.py; do not edit 2 | 3 | ; This file specifies how matched syntax patterns should be highlighted 4 | 5 | [ 6 | "export" 7 | "import" 8 | ] @keyword.control.import 9 | 10 | "mod" @keyword.directive 11 | 12 | [ 13 | "alias" 14 | "set" 15 | "shell" 16 | ] @keyword 17 | 18 | [ 19 | "if" 20 | "else" 21 | ] @keyword.control.conditional 22 | 23 | ; Variables 24 | 25 | (value 26 | (identifier) @variable) 27 | 28 | (alias 29 | left: (identifier) @variable) 30 | 31 | (assignment 32 | left: (identifier) @variable) 33 | 34 | ; Functions 35 | 36 | (recipe_header 37 | name: (identifier) @function) 38 | 39 | (dependency 40 | name: (identifier) @function) 41 | 42 | (dependency_expression 43 | name: (identifier) @function) 44 | 45 | (function_call 46 | name: (identifier) @function) 47 | 48 | ; Parameters 49 | 50 | (parameter 51 | name: (identifier) @variable.parameter) 52 | 53 | ; Namespaces 54 | 55 | (module 56 | name: (identifier) @namespace) 57 | 58 | ; Operators 59 | 60 | [ 61 | ":=" 62 | "?" 63 | "==" 64 | "!=" 65 | "=~" 66 | "@" 67 | "=" 68 | "$" 69 | "*" 70 | "+" 71 | "&&" 72 | "@-" 73 | "-@" 74 | "-" 75 | "/" 76 | ":" 77 | ] @operator 78 | 79 | ; Punctuation 80 | 81 | "," @punctuation.delimiter 82 | 83 | [ 84 | "{" 85 | "}" 86 | "[" 87 | "]" 88 | "(" 89 | ")" 90 | "{{" 91 | "}}" 92 | ] @punctuation.bracket 93 | 94 | [ "`" "```" ] @punctuation.special 95 | 96 | ; Literals 97 | 98 | (boolean) @constant.builtin.boolean 99 | 100 | [ 101 | (string) 102 | (external_command) 103 | ] @string 104 | 105 | (escape_sequence) @constant.character.escape 106 | 107 | ; Comments 108 | 109 | (comment) @comment.line 110 | 111 | (shebang) @keyword.directive 112 | 113 | ; highlight known settings (filtering does not always work) 114 | (setting 115 | left: (identifier) @keyword 116 | (#any-of? @keyword 117 | "allow-duplicate-recipes" 118 | "dotenv-filename" 119 | "dotenv-load" 120 | "dotenv-path" 121 | "export" 122 | "fallback" 123 | "ignore-comments" 124 | "positional-arguments" 125 | "shell" 126 | "tempdi" 127 | "windows-powershell" 128 | "windows-shell")) 129 | 130 | ; highlight known attributes (filtering does not always work) 131 | (attribute 132 | (identifier) @attribute 133 | (#any-of? @attribute 134 | "private" 135 | "allow-duplicate-recipes" 136 | "dotenv-filename" 137 | "dotenv-load" 138 | "dotenv-path" 139 | "export" 140 | "fallback" 141 | "ignore-comments" 142 | "positional-arguments" 143 | "shell" 144 | "tempdi" 145 | "windows-powershell" 146 | "windows-shell")) 147 | 148 | ; Numbers are part of the syntax tree, even if disallowed 149 | (numeric_error) @error 150 | -------------------------------------------------------------------------------- /languages/just/indents.scm: -------------------------------------------------------------------------------- 1 | ; File autogenerated by build-queries-nvim.py; do not edit 2 | 3 | ; This query specifies how to auto-indent logical blocks. 4 | ; 5 | ; Better documentation with diagrams is in https://docs.helix-editor.com/guides/indent.html 6 | 7 | [ 8 | (recipe) 9 | (string) 10 | (external_command) 11 | ] @indent @extend 12 | -------------------------------------------------------------------------------- /languages/just/injections.scm: -------------------------------------------------------------------------------- 1 | ; File autogenerated by build-queries-nvim.py; do not edit 2 | 3 | ; Specify nested languages that live within a `justfile` 4 | 5 | ; FIXME: these are not compatible with helix due to precedence 6 | 7 | ; ================ Always applicable ================ 8 | 9 | ((comment) @injection.content 10 | (#set! injection.language "comment")) 11 | 12 | ; Highlight the RHS of `=~` as regex 13 | ((regex_literal 14 | (_) @injection.content) 15 | (#set! injection.language "regex")) 16 | 17 | ; ================ Global defaults ================ 18 | 19 | ; Default everything to be bash 20 | (recipe_body 21 | !shebang 22 | (#set! injection.language "bash") 23 | (#set! injection.include-children)) @injection.content 24 | 25 | (external_command 26 | (command_body) @injection.content 27 | (#set! injection.language "bash")) 28 | 29 | ; ================ Global language specified ================ 30 | ; Global language is set with something like one of the following: 31 | ; 32 | ; set shell := ["bash", "-c", ...] 33 | ; set shell := ["pwsh.exe"] 34 | ; 35 | ; We can extract the first item of the array, but we can't extract the language 36 | ; name from the string with something like regex. So instead we special case 37 | ; two things: powershell, which is likely to come with a `.exe` attachment that 38 | ; we need to strip, and everything else which hopefully has no extension. We 39 | ; separate this with a `#match?`. 40 | ; 41 | ; Unfortunately, there also isn't a way to allow arbitrary nesting or 42 | ; alternatively set "global" capture variables. So we can set this for item- 43 | ; level external commands, but not for e.g. external commands within an 44 | ; expression without getting _really_ annoying. Should at least look fine since 45 | ; they default to bash. Limitations... 46 | ; See https://github.com/tree-sitter/tree-sitter/issues/880 for more on that. 47 | 48 | (source_file 49 | (setting "shell" ":=" "[" (string) @_langstr 50 | (#match? @_langstr ".*(powershell|pwsh|cmd).*") 51 | (#set! injection.language "powershell")) 52 | [ 53 | (recipe 54 | (recipe_body 55 | !shebang 56 | (#set! injection.include-children)) @injection.content) 57 | 58 | (assignment 59 | (expression 60 | (value 61 | (external_command 62 | (command_body) @injection.content)))) 63 | ]) 64 | 65 | (source_file 66 | (setting "shell" ":=" "[" (string) @injection.language 67 | (#not-match? @injection.language ".*(powershell|pwsh|cmd).*")) 68 | [ 69 | (recipe 70 | (recipe_body 71 | !shebang 72 | (#set! injection.include-children)) @injection.content) 73 | 74 | (assignment 75 | (expression 76 | (value 77 | (external_command 78 | (command_body) @injection.content)))) 79 | ]) 80 | 81 | ; ================ Recipe language specified ================ 82 | 83 | ; Set highlighting for recipes that specify a language, using the exact name by default 84 | (recipe_body ; 85 | (shebang ; 86 | (language) @injection.language) 87 | (#not-any-of? @injection.language "python3" "nodejs" "node") 88 | (#set! injection.include-children)) @injection.content 89 | 90 | ; Transform some known executables 91 | 92 | ; python3 -> python 93 | (recipe_body 94 | (shebang 95 | (language) @_lang) 96 | (#eq? @_lang "python3") 97 | (#set! injection.language "python") 98 | (#set! injection.include-children)) @injection.content 99 | 100 | ; node/nodejs -> javascript 101 | (recipe_body 102 | (shebang 103 | (language) @_lang) 104 | (#any-of? @_lang "node" "nodejs") 105 | (#set! injection.language "javascript") 106 | (#set! injection.include-children)) @injection.content 107 | -------------------------------------------------------------------------------- /languages/just/locals.scm: -------------------------------------------------------------------------------- 1 | ; File autogenerated by build-queries-nvim.py; do not edit 2 | 3 | ; This file tells us about the scope of variables so e.g. local 4 | ; variables override global functions with the same name 5 | 6 | ; Scope 7 | 8 | (recipe) @local.scope 9 | 10 | ; Definitions 11 | 12 | (alias 13 | left: (identifier) @local.definition) 14 | 15 | (assignment 16 | left: (identifier) @local.definition) 17 | 18 | (module 19 | name: (identifier) @local.definition) 20 | 21 | (parameter 22 | name: (identifier) @local.definition) 23 | 24 | (recipe_header 25 | name: (identifier) @local.definition) 26 | 27 | ; References 28 | 29 | (alias 30 | right: (identifier) @local.reference) 31 | 32 | (function_call 33 | name: (identifier) @local.reference) 34 | 35 | (dependency 36 | name: (identifier) @local.reference) 37 | 38 | (dependency_expression 39 | name: (identifier) @local.reference) 40 | 41 | (value 42 | (identifier) @local.reference) 43 | -------------------------------------------------------------------------------- /languages/just/outline.scm: -------------------------------------------------------------------------------- 1 | (recipe_header name: (_) @name) @item 2 | -------------------------------------------------------------------------------- /languages/just/runnables.scm: -------------------------------------------------------------------------------- 1 | ( 2 | (recipe_header name: (_) @run) 3 | (#set! tag just-recipe) 4 | ) 5 | -------------------------------------------------------------------------------- /languages/just/tasks.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "label": "$ZED_SYMBOL", 4 | "command": "cd \"$ZED_DIRNAME\" && just \"$ZED_SYMBOL\"", 5 | "tags": ["just-recipe"] 6 | } 7 | ] 8 | -------------------------------------------------------------------------------- /languages/just/textobjects.scm: -------------------------------------------------------------------------------- 1 | ; File autogenerated by build-queries-nvim.py; do not edit 2 | 3 | ; Specify how to navigate around logical blocks in code 4 | 5 | (recipe 6 | (recipe_body) @function.inside) @function.around 7 | 8 | (parameters 9 | ((_) @parameter.inside . ","? @parameter.around)) @parameter.around 10 | 11 | (dependency_expression 12 | (_) @parameter.inside) @parameter.around 13 | 14 | (function_call 15 | arguments: (sequence 16 | (expression) @parameter.inside) @parameter.around) @function.around 17 | 18 | (comment) @comment.around 19 | -------------------------------------------------------------------------------- /tests/foo.just: -------------------------------------------------------------------------------- 1 | default := "Hello, World!" 2 | 3 | # Comment 4 | echo msg=default: 5 | @echo {{msg}} 6 | -------------------------------------------------------------------------------- /tests/foo.justfile: -------------------------------------------------------------------------------- 1 | default := "Hello, World!" 2 | 3 | # Comment 4 | echo msg=default: 5 | @echo {{msg}} 6 | -------------------------------------------------------------------------------- /tests/just: -------------------------------------------------------------------------------- 1 | default := "Hello, World!" 2 | 3 | # Comment 4 | echo msg=default: 5 | @echo {{msg}} 6 | -------------------------------------------------------------------------------- /tests/justfile: -------------------------------------------------------------------------------- 1 | default := "Hello, World!" 2 | 3 | # Comment 4 | echo msg=default: 5 | @echo {{msg}} 6 | --------------------------------------------------------------------------------