diff --git a/ale_linters/nix/rnix_lsp.vim b/ale_linters/nix/rnix_lsp.vim new file mode 100644 index 00000000..949bed1c --- /dev/null +++ b/ale_linters/nix/rnix_lsp.vim @@ -0,0 +1,16 @@ +" Author: jD91mZM2 +" Description: rnix-lsp language client + +function! ale_linters#nix#rnix_lsp#GetProjectRoot(buffer) abort + " rnix-lsp does not yet use the project root, so getting it right is not + " important + return fnamemodify(a:buffer, ':h') +endfunction + +call ale#linter#Define('nix', { +\ 'name': 'rnix_lsp', +\ 'lsp': 'stdio', +\ 'executable': 'rnix-lsp', +\ 'command': '%e', +\ 'project_root': function('ale_linters#nix#rnix_lsp#GetProjectRoot'), +\}) diff --git a/doc/ale-supported-languages-and-tools.txt b/doc/ale-supported-languages-and-tools.txt index 239927be..2a3fe137 100644 --- a/doc/ale-supported-languages-and-tools.txt +++ b/doc/ale-supported-languages-and-tools.txt @@ -304,6 +304,7 @@ Notes: * nix * `nix-instantiate` * `nixpkgs-fmt` + * `rnix-lsp` * nroff * `alex`!! * `proselint` diff --git a/supported-tools.md b/supported-tools.md index ff4a78d8..6994a337 100644 --- a/supported-tools.md +++ b/supported-tools.md @@ -313,6 +313,7 @@ formatting. * nix * [nix-instantiate](http://nixos.org/nix/manual/#sec-nix-instantiate) * [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt) + * [rnix-lsp](https://github.com/nix-community/rnix-lsp) * nroff * [alex](https://github.com/wooorm/alex) :floppy_disk: * [proselint](http://proselint.com/) diff --git a/test/nix/test.nix b/test/nix/test.nix new file mode 100644 index 00000000..e69de29b diff --git a/test/nix/test_rnix_lsp.vader b/test/nix/test_rnix_lsp.vader new file mode 100644 index 00000000..bf62616b --- /dev/null +++ b/test/nix/test_rnix_lsp.vader @@ -0,0 +1,14 @@ +" Author: jD91mZM2 +" Description: Tests for rnix-lsp language client + +Before: + call ale#assert#SetUpLinterTest('nix', 'rnix_lsp') + +After: + call ale#assert#TearDownLinterTest() + +Execute(should start rnix-lsp): + call ale#test#SetFilename('./test.nix') + AssertLSPLanguage 'nix' + AssertLSPOptions {} + AssertLSPProject ale#path#Simplify('.')