mirror of
https://github.com/nvim-treesitter/nvim-treesitter-context
synced 2024-09-16 22:24:04 +02:00
feat(cue): add context support for CUE
This commit is contained in:
parent
0ddf6f069f
commit
4757afb4f9
3 changed files with 109 additions and 0 deletions
|
@ -25,6 +25,7 @@ Note: if you need support for Neovim 0.6.x please use the tag `compat/0.6`.
|
|||
- [x] `cpp`
|
||||
- [x] `css`
|
||||
- [x] `cuda`
|
||||
- [x] `cue`
|
||||
- [x] `d`
|
||||
- [x] `dart`
|
||||
- [x] `elixir`
|
||||
|
|
19
queries/cue/context.scm
Normal file
19
queries/cue/context.scm
Normal file
|
@ -0,0 +1,19 @@
|
|||
([
|
||||
(import_declaration)
|
||||
(let_clause)
|
||||
] @context)
|
||||
|
||||
(field
|
||||
(value (_) @context.end)
|
||||
) @context
|
||||
|
||||
(call_expression
|
||||
(arguments (_) @context.end)
|
||||
) @context
|
||||
|
||||
(_
|
||||
([
|
||||
(for_clause)
|
||||
(guard_clause)
|
||||
] (_)+ @context.end)
|
||||
) @context
|
89
test/test.cue
Normal file
89
test/test.cue
Normal file
|
@ -0,0 +1,89 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
|
||||
|
||||
|
||||
|
||||
"strings"
|
||||
|
||||
|
||||
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
jsonVal: json.Marshal({
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
hello: strings.ToUpper("world")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
list: [1, 2]
|
||||
nested: foo: "bar"
|
||||
})
|
||||
|
||||
apps: ["nginx", "express", "postgres"]
|
||||
#labels: [string]: string
|
||||
stack: {
|
||||
let local = {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
name: "Alice"
|
||||
|
||||
|
||||
}
|
||||
local
|
||||
|
||||
injected: _ @tag(inj, type=int)
|
||||
|
||||
|
||||
|
||||
for i, app in apps
|
||||
if app != "nginx" {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"\(app)": {
|
||||
if app == "postgres" {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
isPostgres: true
|
||||
}
|
||||
|
||||
|
||||
name: app
|
||||
labels: #labels & {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
app: "foo"
|
||||
tier: "\(i)"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue