Awesome
vscode-just
VSCode syntax highlighting extension for the just language.
Contents:
Features
Basic syntax highlighting for just
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
Known Issues
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.
Nesting and scoping
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}}
Publishing
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 latest release 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
Release Notes
See CHANGELOG.md.
Roadmap
Outstanding:
- Update to match just 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 to open source marketplaces
- Format on save
- Run recipe
Beyond
-
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.
Contributing
See CONTRIBUTING.md.
References
-
Previous iterations on
just
syntax grammars