mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-05-20 22:08:47 +00:00
languages/nix: fix treesitter nvf query for vim.treesitter.queries
This commit is contained in:
parent
10d7bb38ff
commit
cee03d0c97
2 changed files with 30 additions and 41 deletions
|
|
@ -277,8 +277,9 @@
|
||||||
|
|
||||||
- Added {option}`vim.treesitter.queries` to support adding custom queries.
|
- Added {option}`vim.treesitter.queries` to support adding custom queries.
|
||||||
|
|
||||||
- Added injections for `vim.treesitter.queries.*.content` as `query` and
|
- Added injections for `query = '' ... ''` as `query` and `mkLualine '' ... ''`,
|
||||||
`mkLualine`, `entryAnywhere`, `entryBefore`, `entryAfter` as `lua` in nix.
|
`entryAnywhere '' ... ''`, `entryBefore [] '' ... ''`,
|
||||||
|
`entryAfter [] '' ... ''` as `lua` in nix.
|
||||||
|
|
||||||
- Added {option}`vim.languages.tera.treesitter.injection` to configure, what
|
- Added {option}`vim.languages.tera.treesitter.injection` to configure, what
|
||||||
language the content is.
|
language the content is.
|
||||||
|
|
|
||||||
|
|
@ -132,53 +132,41 @@ in {
|
||||||
enable = true;
|
enable = true;
|
||||||
grammars = [cfg.treesitter.package];
|
grammars = [cfg.treesitter.package];
|
||||||
queries = [
|
queries = [
|
||||||
# vim.treesitter.queries.*.content
|
# query = ''; -> query
|
||||||
{
|
{
|
||||||
type = "injections";
|
type = "injections";
|
||||||
filetypes = ["nix"];
|
filetypes = ["nix"];
|
||||||
content = ''
|
query = ''
|
||||||
;; extends
|
;; extends
|
||||||
|
|
||||||
((binding
|
((binding
|
||||||
attrpath: (attrpath
|
attrpath: (attrpath
|
||||||
(identifier) @_a
|
(identifier) @_path)
|
||||||
(identifier) @_b
|
(#eq? @_path "query")
|
||||||
(identifier)? @_c)
|
expression: [
|
||||||
(#eq? @_a "vim")
|
(string_expression
|
||||||
(#any-of? @_b "treesitter")
|
((string_fragment) @injection.content
|
||||||
(#any-of? @_c "queries")
|
(#set! injection.language "query")))
|
||||||
|
(indented_string_expression
|
||||||
expression: (attrset_expression
|
((string_fragment) @injection.content
|
||||||
(binding_set
|
(#set! injection.language "query")))
|
||||||
(binding
|
(apply_expression
|
||||||
attrpath: (attrpath
|
argument: [
|
||||||
(identifier) @_queries)
|
(string_expression
|
||||||
(#eq? @_queries "queries")
|
((string_fragment) @injection.content
|
||||||
|
(#set! injection.language "query")))
|
||||||
expression: (list_expression
|
(indented_string_expression
|
||||||
(attrset_expression
|
((string_fragment) @injection.content
|
||||||
(binding_set
|
(#set! injection.language "query")))
|
||||||
(binding
|
])
|
||||||
attrpath: (attrpath
|
]))
|
||||||
(identifier) @_field)
|
|
||||||
(#eq? @_field "content")
|
|
||||||
|
|
||||||
expression: [
|
|
||||||
(string_expression
|
|
||||||
(string_fragment) @injection.content)
|
|
||||||
(indented_string_expression
|
|
||||||
(string_fragment) @injection.content)
|
|
||||||
]
|
|
||||||
|
|
||||||
(#set! injection.language "query")
|
|
||||||
(#set! injection.combined))))))))))
|
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
# mkLuaInline, entryAnywhere, entryBefore, entryAfter = lua
|
# mkLuaInline, entryAnywhere, entryBefore, entryAfter -> lua
|
||||||
{
|
{
|
||||||
type = "injections";
|
type = "injections";
|
||||||
filetypes = ["nix"];
|
filetypes = ["nix"];
|
||||||
content = ''
|
query = ''
|
||||||
;; extends
|
;; extends
|
||||||
|
|
||||||
((apply_expression
|
((apply_expression
|
||||||
|
|
@ -187,8 +175,8 @@ in {
|
||||||
(#any-of? @_func "mkLuaInline" "entryAnywhere"))
|
(#any-of? @_func "mkLuaInline" "entryAnywhere"))
|
||||||
argument: (indented_string_expression
|
argument: (indented_string_expression
|
||||||
(string_fragment) @injection.content))
|
(string_fragment) @injection.content))
|
||||||
(#set! injection.language "lua")
|
(#set! injection.language "lua")
|
||||||
(#set! injection.combined))
|
(#set! injection.combined))
|
||||||
|
|
||||||
((apply_expression
|
((apply_expression
|
||||||
function: (apply_expression
|
function: (apply_expression
|
||||||
|
|
@ -198,8 +186,8 @@ in {
|
||||||
argument: (_))
|
argument: (_))
|
||||||
argument: (indented_string_expression
|
argument: (indented_string_expression
|
||||||
(string_fragment) @injection.content))
|
(string_fragment) @injection.content))
|
||||||
(#set! injection.language "lua")
|
(#set! injection.language "lua")
|
||||||
(#set! injection.combined))
|
(#set! injection.combined))
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue