Skip to content

Commit

Permalink
♻️ Refactor rule definitions and cleanup inconsistencies (#22)
Browse files Browse the repository at this point in the history
* Overhaul literals

* Split out alias

* Split out import and mod

* Cleanup alias scopes

* Fix backticks in recipe defs

* Remove constants for builtins

* Split out assignment better

* Split keywords

* Break up hard to read recipe regexes

* Break down string and escaping regexes

* chore: remove todo

* Update TODOs

* Readme on multi line not working

* Merge changed sections in changelog

* Fix mod snapshot

* Change optional import from keyword
  • Loading branch information
nefrob authored Jul 8, 2024
1 parent 39fa89b commit 67dcf25
Show file tree
Hide file tree
Showing 22 changed files with 847 additions and 519 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@
### Added

- `HEX` constants
- Optional `?` operator for `import` and `mod`

### Fixed

- Backticks in recipe definitions now highlight correctly

### Changed

- Updated tests
- Cleaned up inconsistent scope names for the same tokens

## [0.3.0] - 2024-06015

Expand Down
33 changes: 28 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,36 @@ Note: Unlike previous iterations of VSCode `just` extensions, this extension doe

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.

- Interpolation blocks, e.g. `{{ variable }}`, color all content as a string. Ideally it should match base `just` language highlighting, however limitations of regexs make comprehensive highlighting here complex or impossible for certain scenarios.

- This extension is not available on open source marketplaces (for now). If you are using an open source build of VSCode, you might need to install the extension manually. To do so:
#### Nesting and scoping

1. Navigate to the latest [release](https://github.com/nefrob/vscode-just/releases) and download the `.vsix` file.
2. Copy the file to your `.vscode/extensions` directory.
3. Install via the command line: `code --install-extension .vscode/extensions/vscode-just-X.Y.Z.vsix`
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 means `just` keywords/operators/etc, like `if`, 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 not available on open source marketplaces (for now). If you are using an open source build of VSCode, you might need to install the extension manually. To do so:
1. Navigate to the latest [release](https://github.com/nefrob/vscode-just/releases) and download the `.vsix` file.
2. Copy the file to your `.vscode/extensions` directory.
3. Install via the command line: `code --install-extension .vscode/extensions/vscode-just-X.Y.Z.vsix`
## Release Notes
Expand Down
Loading

0 comments on commit 67dcf25

Please sign in to comment.