Compare commits

...

4 Commits

6 changed files with 38 additions and 6 deletions

View File

@ -22,7 +22,7 @@ function! ale#definition#HandleTSServerResponse(conn_id, response) abort
\&& has_key(s:go_to_definition_map, a:response.request_seq)
let l:options = remove(s:go_to_definition_map, a:response.request_seq)
if get(a:response, 'success', v:false) is v:true
if get(a:response, 'success', v:false) is v:true && !empty(a:response.body)
let l:filename = a:response.body[0].file
let l:line = a:response.body[0].start.line
let l:column = a:response.body[0].start.offset

View File

@ -207,6 +207,11 @@ function! ale#lsp#HandleOtherInitializeResponses(conn, response) abort
endfunction
function! ale#lsp#HandleMessage(conn, message) abort
if type(a:message) != type('')
" Ignore messages that aren't strings.
return
endif
let a:conn.data .= a:message
" Parse the objects now if we can, and keep the remaining text.

View File

@ -23,7 +23,8 @@ function! s:CmpPatterns(left_item, right_item) abort
endfunction
function! ale#pattern_options#SetOptions(buffer) abort
if !g:ale_pattern_options_enabled || empty(g:ale_pattern_options)
if !get(g:, 'ale_pattern_options_enabled', 0)
\|| empty(get(g:, 'ale_pattern_options', 0))
return
endif

View File

@ -19,12 +19,14 @@ g:ale_gitcommit_gitlint_options *g:ale_gitcommit_gitlint_options*
Default: `''`
This variable can be changed to add command-line arguments to the gitlint
invocation.
invocation. For example, you can specify the path to a configuration file. >
For example, to dinamically set the gitlint configuration file path, you
may want to set >
let g:ale_gitcommit_gitlint_options = '-C /home/user/.config/gitlint.ini'
<
You can also disable particular error codes using this option. For example,
you can ignore errors for git commits with a missing body. >
let g:ale_gitcommit_gitlint_options = '-C /home/user/.config/gitlint.ini'
let g:ale_gitcommit_gitlint_options = '--ignore B6'
<
g:ale_gitcommit_gitlint_use_global *g:ale_gitcommit_gitlint_use_global*

View File

@ -56,6 +56,19 @@ Execute(Failed definition responses should be handled correctly):
\)
AssertEqual {}, ale#definition#GetMap()
Execute(Failed definition responses with no files should be handled correctly):
call ale#definition#SetMap({3: {'open_in_tab': 0}})
call ale#definition#HandleTSServerResponse(
\ 1,
\ {
\ 'command': 'definition',
\ 'request_seq': 3,
\ 'success': v:true,
\ 'body': [],
\ }
\)
AssertEqual {}, ale#definition#GetMap()
Given typescript(Some typescript file):
foo
somelongerline

View File

@ -90,3 +90,14 @@ Execute(Patterns should be applied after the Dictionary changes):
call ale#pattern_options#SetOptions(bufnr(''))
AssertEqual 666, b:some_option
Execute(SetOptions should tolerate settings being unset):
" This might happen if ALE is loaded in a weird way, so tolerate it.
unlet! g:ale_pattern_options
unlet! g:ale_pattern_options_enabled
call ale#pattern_options#SetOptions(bufnr(''))
let g:ale_pattern_options_enabled = 1
call ale#pattern_options#SetOptions(bufnr(''))