mirror of https://github.com/dense-analysis/ale
Handle definition responses without files
This commit is contained in:
parent
10e1545630
commit
6a7e00d9ac
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue