diff options
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | autoload/ale/lsp.vim | 17 | ||||
-rw-r--r-- | autoload/ale/util.vim | 4 | ||||
-rw-r--r-- | doc/ale-typescript.txt | 10 | ||||
-rw-r--r-- | doc/ale-yaml.txt | 14 | ||||
-rw-r--r-- | doc/ale.txt | 3 | ||||
-rw-r--r-- | test/test_go_to_definition.vader | 10 |
7 files changed, 36 insertions, 24 deletions
@@ -190,7 +190,7 @@ formatting. | 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/) | +| YAML | [prettier](https://github.com/prettier/prettier), [swaglint](https://github.com/byCedric/swaglint), [yamllint](https://yamllint.readthedocs.io/) | | YANG | [yang-lsp](https://github.com/theia-ide/yang-lsp) | <a name="usage"></a> diff --git a/autoload/ale/lsp.vim b/autoload/ale/lsp.vim index 5d900138..cfc89199 100644 --- a/autoload/ale/lsp.vim +++ b/autoload/ale/lsp.vim @@ -300,19 +300,6 @@ function! ale#lsp#HandleMessage(conn, message) abort endfor endfunction -function! s:HandleChannelMessage(channel_id, message) abort - let l:address = ale#socket#GetAddress(a:channel_id) - let l:conn = s:FindConnection('id', l:address) - - call ale#lsp#HandleMessage(l:conn, a:message) -endfunction - -function! s:HandleCommandMessage(job_id, message) abort - let l:conn = s:FindConnection('id', a:job_id) - - call ale#lsp#HandleMessage(l:conn, a:message) -endfunction - " Given a connection ID, mark it as a tsserver connection, so it will be " handled that way. function! ale#lsp#MarkConnectionAsTsserver(conn_id) abort @@ -373,7 +360,7 @@ function! ale#lsp#StartProgram(executable, command, init_options) abort if !has_key(l:conn, 'id') || !ale#job#IsRunning(l:conn.id) let l:options = { \ 'mode': 'raw', - \ 'out_cb': function('s:HandleCommandMessage'), + \ 'out_cb': {_, message -> ale#lsp#HandleMessage(l:conn, message)}, \} let l:job_id = ale#job#Start(a:command, l:options) else @@ -397,7 +384,7 @@ function! ale#lsp#ConnectToAddress(address, init_options) abort if !has_key(l:conn, 'channel_id') || !ale#socket#IsOpen(l:conn.channel_id) let l:conn.channel_id = ale#socket#Open(a:address, { - \ 'callback': function('s:HandleChannelMessage'), + \ 'callback': {_, message -> ale#lsp#HandleMessage(l:conn, message)}, \}) endif diff --git a/autoload/ale/util.vim b/autoload/ale/util.vim index be37d1b5..e9b5688d 100644 --- a/autoload/ale/util.vim +++ b/autoload/ale/util.vim @@ -88,10 +88,10 @@ endfunction function! ale#util#Open(filename, line, column, options) abort if get(a:options, 'open_in_tab', 0) - call ale#util#Execute('tabedit ' . fnameescape(a:filename)) + call ale#util#Execute('tabedit +' . a:line . ' ' . fnameescape(a:filename)) elseif bufnr(a:filename) isnot bufnr('') " Open another file only if we need to. - call ale#util#Execute('edit ' . fnameescape(a:filename)) + call ale#util#Execute('edit +' . a:line . ' ' . fnameescape(a:filename)) else normal! m` endif diff --git a/doc/ale-typescript.txt b/doc/ale-typescript.txt index 1bccf5a3..0cb0a7c2 100644 --- a/doc/ale-typescript.txt +++ b/doc/ale-typescript.txt @@ -19,6 +19,16 @@ See |ale-javascript-prettier| for information about the available options. =============================================================================== tslint *ale-typescript-tslint* +This linter isn't recommended, because TSLint can't be used for checking for +problems while you type. You should probably use the tsserver plugin instead. + +Follow the instructions on the plugin website for installing it: +https://github.com/angelozerr/tsserver-plugins + +Then disable TSLint in vimrc or any other Vim configuration file. > + let g:ale_linters_ignore = {'typescript': ['tslint']} +< + g:ale_typescript_tslint_executable *g:ale_typescript_tslint_executable* *b:ale_typescript_tslint_executable* Type: |String| diff --git a/doc/ale-yaml.txt b/doc/ale-yaml.txt index 044d0b3d..c9a12ea1 100644 --- a/doc/ale-yaml.txt +++ b/doc/ale-yaml.txt @@ -1,7 +1,21 @@ =============================================================================== ALE YAML Integration *ale-yaml-options* +=============================================================================== +prettier *ale-yaml-prettier* + +Website: https://github.com/prettier/prettier + + +Installation +------------------------------------------------------------------------------- +Install prettier either globally or locally: > + + npm install prettier -g # global + npm install prettier # local +< + =============================================================================== swaglint *ale-yaml-swaglint* diff --git a/doc/ale.txt b/doc/ale.txt index 3549a010..8af4c435 100644 --- a/doc/ale.txt +++ b/doc/ale.txt @@ -290,6 +290,7 @@ CONTENTS *ale-contents* xml...................................|ale-xml-options| xmllint.............................|ale-xml-xmllint| yaml..................................|ale-yaml-options| + prettier............................|ale-yaml-prettier| swaglint............................|ale-yaml-swaglint| yamllint............................|ale-yaml-yamllint| yang..................................|ale-yang-options| @@ -436,7 +437,7 @@ Notes: * Vue: `prettier`, `vls` * XHTML: `alex`!!, `proselint`, `write-good` * XML: `xmllint` -* YAML: `swaglint`, `yamllint` +* YAML: `prettier`, `swaglint`, `yamllint` * YANG: `yang-lsp` =============================================================================== diff --git a/test/test_go_to_definition.vader b/test/test_go_to_definition.vader index 7f0e3fcb..53f566e9 100644 --- a/test/test_go_to_definition.vader +++ b/test/test_go_to_definition.vader @@ -111,7 +111,7 @@ Execute(Other files should be jumped to for definition responses): AssertEqual \ [ - \ 'edit ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')), + \ 'edit +3 ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')), \ ], \ g:expr_list AssertEqual [3, 7], getpos('.')[1:2] @@ -136,7 +136,7 @@ Execute(Other files should be jumped to for definition responses in tabs too): AssertEqual \ [ - \ 'tabedit ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')), + \ 'tabedit +3 ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')), \ ], \ g:expr_list AssertEqual [3, 7], getpos('.')[1:2] @@ -206,7 +206,7 @@ Execute(Other files should be jumped to for LSP definition responses): AssertEqual \ [ - \ 'edit ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')), + \ 'edit +3 ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')), \ ], \ g:expr_list AssertEqual [3, 7], getpos('.')[1:2] @@ -251,7 +251,7 @@ Execute(Other files should be jumped to in tabs for LSP definition responses): AssertEqual \ [ - \ 'tabedit ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')), + \ 'tabedit +3 ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')), \ ], \ g:expr_list AssertEqual [3, 7], getpos('.')[1:2] @@ -282,7 +282,7 @@ Execute(Definition responses with lists should be handled): AssertEqual \ [ - \ 'edit ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')), + \ 'edit +3 ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')), \ ], \ g:expr_list AssertEqual [3, 7], getpos('.')[1:2] |