summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjD91mZM2 <me@krake.one>2021-01-22 17:29:51 +0100
committerjD91mZM2 <me@krake.one>2021-01-23 13:23:14 +0100
commitc1b6628425a87a7466c09afbd5f6c90217aa9ab0 (patch)
treed5d568fde678ce58878b00553995d2f6d07ee282
parent9a1e91e075abf386e8c6fd620ec0835e566a7db1 (diff)
downloadale-c1b6628425a87a7466c09afbd5f6c90217aa9ab0.zip
Add rnix-lsp for Nix diagnostics and completion
-rw-r--r--ale_linters/nix/rnix_lsp.vim16
-rw-r--r--doc/ale-supported-languages-and-tools.txt1
-rw-r--r--supported-tools.md1
-rw-r--r--test/nix/test.nix0
-rw-r--r--test/nix/test_rnix_lsp.vader14
5 files changed, 32 insertions, 0 deletions
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 <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'),
+\})
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
--- /dev/null
+++ b/test/nix/test.nix
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 <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('.')