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) \&& has_key(s:go_to_definition_map, a:response.request_seq)
let l:options = remove(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:filename = a:response.body[0].file
let l:line = a:response.body[0].start.line let l:line = a:response.body[0].start.line
let l:column = a:response.body[0].start.offset let l:column = a:response.body[0].start.offset

View file

@ -207,6 +207,11 @@ function! ale#lsp#HandleOtherInitializeResponses(conn, response) abort
endfunction endfunction
function! ale#lsp#HandleMessage(conn, message) abort 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 let a:conn.data .= a:message
" Parse the objects now if we can, and keep the remaining text. " 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 endfunction
function! ale#pattern_options#SetOptions(buffer) abort 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 return
endif endif

View file

@ -19,13 +19,15 @@ g:ale_gitcommit_gitlint_options *g:ale_gitcommit_gitlint_options*
Default: `''` Default: `''`
This variable can be changed to add command-line arguments to the gitlint 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' 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* g:ale_gitcommit_gitlint_use_global *g:ale_gitcommit_gitlint_use_global*
*b: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() 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): Given typescript(Some typescript file):
foo foo
somelongerline somelongerline

View file

@ -90,3 +90,14 @@ Execute(Patterns should be applied after the Dictionary changes):
call ale#pattern_options#SetOptions(bufnr('')) call ale#pattern_options#SetOptions(bufnr(''))
AssertEqual 666, b:some_option 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(''))