Add rnix-lsp for Nix diagnostics and completion
This commit is contained in:
parent
9a1e91e075
commit
c1b6628425
5 changed files with 32 additions and 0 deletions
16
ale_linters/nix/rnix_lsp.vim
Normal file
16
ale_linters/nix/rnix_lsp.vim
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
" Author: jD91mZM2 <me@krake.one>
|
||||||
|
" 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'),
|
||||||
|
\})
|
|
@ -304,6 +304,7 @@ Notes:
|
||||||
* nix
|
* nix
|
||||||
* `nix-instantiate`
|
* `nix-instantiate`
|
||||||
* `nixpkgs-fmt`
|
* `nixpkgs-fmt`
|
||||||
|
* `rnix-lsp`
|
||||||
* nroff
|
* nroff
|
||||||
* `alex`!!
|
* `alex`!!
|
||||||
* `proselint`
|
* `proselint`
|
||||||
|
|
|
@ -313,6 +313,7 @@ formatting.
|
||||||
* nix
|
* nix
|
||||||
* [nix-instantiate](http://nixos.org/nix/manual/#sec-nix-instantiate)
|
* [nix-instantiate](http://nixos.org/nix/manual/#sec-nix-instantiate)
|
||||||
* [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt)
|
* [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt)
|
||||||
|
* [rnix-lsp](https://github.com/nix-community/rnix-lsp)
|
||||||
* nroff
|
* nroff
|
||||||
* [alex](https://github.com/wooorm/alex) :floppy_disk:
|
* [alex](https://github.com/wooorm/alex) :floppy_disk:
|
||||||
* [proselint](http://proselint.com/)
|
* [proselint](http://proselint.com/)
|
||||||
|
|
0
test/nix/test.nix
Normal file
0
test/nix/test.nix
Normal file
14
test/nix/test_rnix_lsp.vader
Normal file
14
test/nix/test_rnix_lsp.vader
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
" Author: jD91mZM2 <me@krake.one>
|
||||||
|
" 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('.')
|
Reference in a new issue