mirror of
https://github.com/nvim-treesitter/nvim-treesitter-context
synced 2024-09-16 22:24:04 +02:00
feat: add jsonnet support
This commit is contained in:
parent
44d270e9d1
commit
bc19b78e9c
3 changed files with 52 additions and 1 deletions
|
@ -38,6 +38,7 @@ Note: if you need support for Neovim 0.6.x please use the tag `compat/0.6`.
|
|||
- [x] `java`
|
||||
- [x] `javascript`
|
||||
- [x] `json`
|
||||
- [x] `jsonnet`
|
||||
- [x] `julia`
|
||||
- [x] `latex`
|
||||
- [x] `lua`
|
||||
|
@ -121,7 +122,6 @@ Note: if you need support for Neovim 0.6.x please use the tag `compat/0.6`.
|
|||
- [ ] `jsdoc`
|
||||
- [ ] `json5`
|
||||
- [ ] `jsonc`
|
||||
- [ ] `jsonnet`
|
||||
- [ ] `jsx`
|
||||
- [ ] `kdl`
|
||||
- [ ] `kotlin`
|
||||
|
|
11
queries/jsonnet/context.scm
Normal file
11
queries/jsonnet/context.scm
Normal file
|
@ -0,0 +1,11 @@
|
|||
(conditional
|
||||
consequence: (_) @context.end
|
||||
) @context
|
||||
|
||||
([
|
||||
(bind)
|
||||
(field)
|
||||
(forspec)
|
||||
(anonymous_function)
|
||||
(functioncall)
|
||||
] @context)
|
40
test/test.jsonnet
Normal file
40
test/test.jsonnet
Normal file
|
@ -0,0 +1,40 @@
|
|||
local content =
|
||||
local organizer(person) =
|
||||
if person == 'Mary' then
|
||||
'Mary will not be with us today, due to her health issue.'
|
||||
else
|
||||
std.format("Welcome %s as an honor guest for the party.", [person]);
|
||||
|
||||
function(people) {
|
||||
invited: [organizer(x) for x in people],
|
||||
participants: [
|
||||
std.format(|||
|
||||
Welcome %s to the party!
|
||||
They're currently working as a %s for company %s.
|
||||
|||, [
|
||||
x.name,
|
||||
x.job,
|
||||
x.company,
|
||||
])
|
||||
for x in [
|
||||
{
|
||||
name: 'Martin',
|
||||
job: 'Java Developer',
|
||||
company: 'A',
|
||||
},
|
||||
{
|
||||
name: 'Robert',
|
||||
job: 'DevOps Engineer',
|
||||
company: 'B',
|
||||
},
|
||||
]
|
||||
],
|
||||
};
|
||||
|
||||
content([
|
||||
'Mary',
|
||||
'Peter',
|
||||
'James',
|
||||
'John',
|
||||
'Mathew',
|
||||
])
|
Loading…
Reference in a new issue