summaryrefslogtreecommitdiff
path: root/ale_linters/nim
diff options
context:
space:
mode:
authorJerko Steiner <jerko.steiner@gmail.com>2019-10-18 01:32:31 +0900
committerw0rp <w0rp@users.noreply.github.com>2019-10-17 17:32:31 +0100
commite5a4c82917a17e759350d5137fb1afbf3e933c2a (patch)
tree39cf59399d9d8a422c64b4c14dc141c208dedf08 /ale_linters/nim
parentf4070f6c43b3cb2e7463d8426a68d5a726991288 (diff)
downloadale-e5a4c82917a17e759350d5137fb1afbf3e933c2a.zip
Add support for nimlsp (#2815)
* Add support for nimlsp.vim * Add test and docs for nimlsp * Add nimlsp to supported-tools.md * Add nimlsp to doc/ale-supported-languages-and-tools.txt
Diffstat (limited to 'ale_linters/nim')
-rw-r--r--ale_linters/nim/nimlsp.vim33
1 files changed, 33 insertions, 0 deletions
diff --git a/ale_linters/nim/nimlsp.vim b/ale_linters/nim/nimlsp.vim
new file mode 100644
index 00000000..5d041043
--- /dev/null
+++ b/ale_linters/nim/nimlsp.vim
@@ -0,0 +1,33 @@
+" Author: jeremija <https://github.com/jeremija>
+" Description: Support for nimlsp (language server for nim)
+
+call ale#Set('nim_nimlsp_nim_sources', '')
+
+function! ale_linters#nim#nimlsp#GetProjectRoot(buffer) abort
+ let l:project_root = ale#path#FindNearestDirectory(a:buffer, '.git')
+
+ if !empty(l:project_root)
+ return fnamemodify(l:project_root, ':h:h')
+ endif
+
+ return ''
+endfunction
+
+function! ale_linters#nim#nimlsp#GetCommand(buffer) abort
+ let l:nim_sources = ale#Var(a:buffer, 'nim_nimlsp_nim_sources')
+
+ if !empty(l:nim_sources)
+ let l:nim_sources = ale#Escape(l:nim_sources)
+ endif
+
+ return '%e' . ale#Pad(l:nim_sources)
+endfunction
+
+call ale#linter#Define('nim', {
+\ 'name': 'nimlsp',
+\ 'lsp': 'stdio',
+\ 'executable': 'nimlsp',
+\ 'command': function('ale_linters#nim#nimlsp#GetCommand'),
+\ 'language': 'nim',
+\ 'project_root': function('ale_linters#nim#nimlsp#GetProjectRoot'),
+\})