Compare commits

...
This repository has been archived on 2024-07-19. You can view files and clone it, but cannot push or open issues or pull requests.

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,13 +19,15 @@ 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.
For example, to dinamically set the gitlint configuration file path, you
may want to set >
invocation. For example, you can specify the path to a configuration file. >
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 = '--ignore B6'
<
g:ale_gitcommit_gitlint_use_global *g:ale_gitcommit_gitlint_use_global*
*b: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(''))