Skip to content

Commit

Permalink
Update nvim to use the latest captures
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross35 committed Mar 3, 2024
1 parent 4427d40 commit 2f48ff7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ require("nvim-treesitter.parsers").get_parser_configs().just = {

Don't forget to `:TSInstall` after adding this. With this method you do not have to add this repo as a plugin.

If you run into problems relating to C++ 11 features, try including this in your setup (you may have to `brew install gcc@11`):
## Compatibility

```lua
require"nvim-treesitter.install".compilers = {"gcc-11"}
```
Note that for locals to work correctly, you need a pretty recent version of
`nvim-treesitter` since after the capture names changed. Any version at or after
0.9.3 (currently unreleased) should work.

## Contributing

Expand Down Expand Up @@ -125,6 +125,6 @@ readable.
- [ ] Write the queries
- [x] Implement support for code folding using `nvim-treesitter` (`folds.scm`)
- [x] Write the queries
- [ ] Write Tests
- [x] Write Tests
- [x] Highlight the fish/bash/etc inside recipes (use tree-sitter injections)
- [ ] Fix weirdness around trailing whitespace (don't leave trailing whitespace after the recipe header)
5 changes: 2 additions & 3 deletions build-flavored-queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
from pathlib import Path

REPLACEMENTS = [
("@local.definition", "@definition"),
("@local.reference", "@reference"),
("@local.scope", "@scope"),
# nvim uses `var` instead of variable
("@local.definition.variable", "@local.definiton.var"),
("@constants.builtin.boolean", "@boolean"),
("@keyword.control.conditional", "@conditional"),
("@variable.parameter", "@parameter"),
Expand Down
22 changes: 11 additions & 11 deletions queries/just/locals.scm
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@

; Scope

(recipe) @scope
(recipe) @local.scope

; Definitions

(alias left: (identifier) @definition.variable)
(alias left: (identifier) @local.definiton.var)

(assignment left: (identifier) @definition.variable)
(assignment left: (identifier) @local.definiton.var)

(module name: (identifier) @definition.namespace)
(module name: (identifier) @local.definition.namespace)

(parameter name: (identifier) @definition.variable)
(parameter name: (identifier) @local.definiton.var)

(recipe_header name: (identifier) @definition.function)
(recipe_header name: (identifier) @local.definition.function)

; References

(alias right: (identifier) @reference.variable)
(alias right: (identifier) @local.reference.variable)

(function_call name: (identifier) @reference.function)
(function_call name: (identifier) @local.reference.function)

(dependency name: (identifier) @reference.function)
(dependency name: (identifier) @local.reference.function)

(dependency_expression name: (identifier) @reference.function)
(dependency_expression name: (identifier) @local.reference.function)

(value (identifier) @reference.variable)
(value (identifier) @local.reference.variable)

0 comments on commit 2f48ff7

Please sign in to comment.