feat: add jsonnet support

This commit is contained in:
Hoang Nguyen 2023-10-01 00:00:00 +07:00 committed by Lewis Russell
parent 44d270e9d1
commit bc19b78e9c
3 changed files with 52 additions and 1 deletions

View file

@ -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`

View file

@ -0,0 +1,11 @@
(conditional
consequence: (_) @context.end
) @context
([
(bind)
(field)
(forspec)
(anonymous_function)
(functioncall)
] @context)

40
test/test.jsonnet Normal file
View 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',
])