summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoracio Sanson <hsanson@gmail.com>2021-01-23 21:50:36 +0900
committerGitHub <noreply@github.com>2021-01-23 21:50:36 +0900
commit9fd9435cd525b1d3c4470db0d514f72ed31cfece (patch)
tree98504c77dbb4412e04830a7360ee9b8392c8f2f3
parent1101346657edec80cbcbf7d1517711bf10b45847 (diff)
parentc1b6628425a87a7466c09afbd5f6c90217aa9ab0 (diff)
downloadale-9fd9435cd525b1d3c4470db0d514f72ed31cfece.zip
Merge pull request #3556 from jD91mZM2/rnix
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 db647445..ac99f6ff 100644
--- a/doc/ale-supported-languages-and-tools.txt
+++ b/doc/ale-supported-languages-and-tools.txt
@@ -310,6 +310,7 @@ Notes:
* nix
* `nix-instantiate`
* `nixpkgs-fmt`
+ * `rnix-lsp`
* nroff
* `alex`!!
* `proselint`
diff --git a/supported-tools.md b/supported-tools.md
index 92ae8d83..90485281 100644
--- a/supported-tools.md
+++ b/supported-tools.md
@@ -319,6 +319,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('.')