- Notifications
You must be signed in to change notification settings - Fork1
VSCode syntax highlighting for just files
License
nefrob/vscode-just
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
VSCode syntax highlighting extension for thejust language.
Contents:
Basic syntax highlighting forjust
files:
- Comments
- Variable assignment and settings
- Strings & interpolation blocks
- Recipes: recipe attributes, names, params and dependencies
- Keywords, constants and operators
- Some embedded languages
Commands:
- Format on save
- Run recipe
- Task running
Demo:
GitHub syntax highlighting
# Demosettempdir:="/tmp"exportMY_VAR:=`./my_script.sh`[confirm("Continue?")]@fooPARAM_1="hello"PARAM_2="world"+ARGS="": echo{{ PARAM_1}}{{ PARAM_2}}{{ ARGS}}python:#!/usr/bin/env python3print('Hello from python!')
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.
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 meansjust
keywords/operators/etc, likeif
, 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}}
This extension is available on the following marketplaces:
If you are using an open source build of VSCode, you might need to install the extension manually. To do so:
- Navigate to the latestrelease and download the
.vsix
file. - Copy the file to your
.vscode/extensions
directory. - Install via the command line:
code --install-extension .vscode/extensions/vscode-just-X.Y.Z.vsix
SeeCHANGELOG.md.
Outstanding:
- Update to matchjust grammar more accurately
- Improve escaping within strings
Completed:
- Initial release
- Update with new
just
releases - Migrate to
yaml
grammar for composability and readability - Add snapshot testing
- Publish toopen source marketplaces
- Format on save
- Run recipe
Semantic highlighting / LSP
To avoid implementing a parser for files, it would be ideal for
just
to expose the AST or other APIs for editor extensions to leverage. This would allow for more advanced features like semantic highlighting, code folding, and more.If VSCode works to support tree-sitter,that would be a possible alternative.
SeeCONTRIBUTING.md.
Previous iterations on
just
syntax grammars
About
VSCode syntax highlighting for just files