summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Olofsson <alexander.olofsson@liu.se>2018-07-05 14:04:20 +0200
committerAlexander Olofsson <alexander.olofsson@liu.se>2018-07-05 14:04:20 +0200
commitfd42e8e935e31ac7eef8db821302280d12e6cff0 (patch)
tree6bd868843411843b93fe936d80134991aad93b4d
parentd49daeb816217014a50bdab9d61b22535e55b179 (diff)
downloadale-fd42e8e935e31ac7eef8db821302280d12e6cff0.zip
vue: Add the vls language server linter
-rw-r--r--README.md2
-rw-r--r--ale_linters/vue/vls.vim32
-rw-r--r--doc/ale-vue.txt20
-rw-r--r--doc/ale.txt3
4 files changed, 55 insertions, 2 deletions
diff --git a/README.md b/README.md
index caddc590..584861c0 100644
--- a/README.md
+++ b/README.md
@@ -185,7 +185,7 @@ formatting.
| Verilog | [iverilog](https://github.com/steveicarus/iverilog), [verilator](http://www.veripool.org/projects/verilator/wiki/Intro) |
| Vim | [vint](https://github.com/Kuniwak/vint) |
| Vim help^ | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
-| Vue | [prettier](https://github.com/prettier/prettier) |
+| Vue | [prettier](https://github.com/prettier/prettier), [vls](https://github.com/vuejs/vetur/tree/master/server) |
| XHTML | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
| XML | [xmllint](http://xmlsoft.org/xmllint.html) |
| YAML | [swaglint](https://github.com/byCedric/swaglint), [yamllint](https://yamllint.readthedocs.io/) |
diff --git a/ale_linters/vue/vls.vim b/ale_linters/vue/vls.vim
new file mode 100644
index 00000000..0d4bf9f6
--- /dev/null
+++ b/ale_linters/vue/vls.vim
@@ -0,0 +1,32 @@
+" Author: Alexander Olofsson <alexander.olofsson@liu.se>
+" Description: Vue vls Language Server integration for ALE
+
+call ale#Set('vue_vls_executable', 'vls')
+call ale#Set('vue_vls_use_global', get(g:, 'ale_use_global_executables', 0))
+
+function! ale_linters#vue#vls#GetExecutable(buffer) abort
+ return ale#node#FindExecutable(a:buffer, 'vue_vls', [
+ \ 'node_modules/.bin/vls',
+ \])
+endfunction
+
+function! ale_linters#vue#vls#GetCommand(buffer) abort
+ let l:exe = ale#Escape(ale_linters#vue#vls#GetExecutable(a:buffer))
+
+ return l:exe . ' --stdio'
+endfunction
+
+function! ale_linters#vue#vls#GetProjectRoot(buffer) abort
+ let l:package_path = ale#path#FindNearestFile(a:buffer, 'package.json')
+
+ return !empty(l:package_path) ? fnamemodify(l:package_path, ':h') : ''
+endfunction
+
+call ale#linter#Define('vue', {
+\ 'name': 'vls',
+\ 'lsp': 'stdio',
+\ 'executable_callback': 'ale_linters#vue#vls#GetExecutable',
+\ 'command_callback': 'ale_linters#vue#vls#GetCommand',
+\ 'language': 'vue',
+\ 'project_root_callback': 'ale_linters#vue#vls#GetProjectRoot',
+\})
diff --git a/doc/ale-vue.txt b/doc/ale-vue.txt
index 937b603b..a2c2786f 100644
--- a/doc/ale-vue.txt
+++ b/doc/ale-vue.txt
@@ -7,5 +7,25 @@ prettier *ale-vue-prettier*
See |ale-javascript-prettier| for information about the available options.
+
+===============================================================================
+vls *ale-vue-vls*
+
+g:ale_vue_vls_executable *g:ale_vue_vls_executable*
+ *b:ale_vue_vls_executable*
+ Type: |String|
+ Default: `'vls'`
+
+ See |ale-integrations-local-executables|
+
+
+g:ale_vue_vls_use_global *g:ale_vue_vls_use_global*
+ *b:ale_vue_vls_use_global*
+ Type: |Number|
+ Default: `get(g:, 'ale_use_global_executables', 0)`
+
+ See |ale-integrations-local-executables|
+
+
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
diff --git a/doc/ale.txt b/doc/ale.txt
index 9283765f..b500d5d4 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -273,6 +273,7 @@ CONTENTS *ale-contents*
write-good..........................|ale-vim-help-write-good|
vue...................................|ale-vue-options|
prettier............................|ale-vue-prettier|
+ vls.................................|ale-vue-vls|
xhtml.................................|ale-xhtml-options|
write-good..........................|ale-xhtml-write-good|
xml...................................|ale-xml-options|
@@ -418,7 +419,7 @@ Notes:
* Verilog: `iverilog`, `verilator`
* Vim: `vint`
* Vim help^: `alex`!!, `proselint`, `write-good`
-* Vue: `prettier`
+* Vue: `prettier`, `vls`
* XHTML: `alex`!!, `proselint`, `write-good`
* XML: `xmllint`
* YAML: `swaglint`, `yamllint`