mirror of
https://github.com/nvim-treesitter/nvim-treesitter-context
synced 2024-09-16 14:14:03 +02:00
feat: add initial Nix support
This commit is contained in:
parent
2182556aab
commit
e2ea37627c
3 changed files with 97 additions and 1 deletions
|
@ -56,6 +56,7 @@ use 'nvim-treesitter/nvim-treesitter-context'
|
|||
- [x] `lua`
|
||||
- [x] `markdown`
|
||||
- [x] `matlab`
|
||||
- [x] `nix`
|
||||
- [x] `norg`
|
||||
- [x] `ocaml_interface`
|
||||
- [x] `ocaml`
|
||||
|
@ -146,7 +147,6 @@ use 'nvim-treesitter/nvim-treesitter-context'
|
|||
- [ ] `mermaid`
|
||||
- [ ] `meson`
|
||||
- [ ] `nickel`
|
||||
- [ ] `nix`
|
||||
- [ ] `ocamllex`
|
||||
- [ ] `pascal`
|
||||
- [ ] `perl`
|
||||
|
|
2
queries/nix/context.scm
Normal file
2
queries/nix/context.scm
Normal file
|
@ -0,0 +1,2 @@
|
|||
(function_expression body: (_ (_) @context.end)) @context
|
||||
(binding expression: (_ (_) @context.end)) @context
|
94
test/test.nix
Normal file
94
test/test.nix
Normal file
|
@ -0,0 +1,94 @@
|
|||
|
||||
{
|
||||
output =
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
let
|
||||
l = {
|
||||
a = false;
|
||||
b = false;
|
||||
c = false;
|
||||
}; #Succe
|
||||
m = {
|
||||
a = false;
|
||||
b = true;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
c = false;
|
||||
}; #Success
|
||||
n = {
|
||||
a = false;
|
||||
b = true;
|
||||
c = true;
|
||||
}; #Fail
|
||||
|
||||
functions = {
|
||||
check = pkgs:
|
||||
list:
|
||||
let
|
||||
length =
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
builtins.length (pkgs.lib.remove false list);
|
||||
|
||||
|
||||
|
||||
otherfunc = { a, b, c, ... }@nice: a + b + c;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
setFunc =
|
||||
{ a
|
||||
, b
|
||||
, c
|
||||
, ...
|
||||
}@extras: (
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
a * b * c
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
);
|
||||
in
|
||||
(length == 0) || (length == 1);
|
||||
};
|
||||
in
|
||||
functions.check l;
|
||||
}
|
Loading…
Reference in a new issue