Fix #1661 - Do not use :edit when jumping inside of a file
This commit is contained in:
parent
22533f2c1f
commit
8bca073763
@ -56,7 +56,10 @@ function! ale#util#Open(filename, line, column, options) abort
|
|||||||
if get(a:options, 'open_in_tab', 0)
|
if get(a:options, 'open_in_tab', 0)
|
||||||
call ale#util#Execute('tabedit ' . fnameescape(a:filename))
|
call ale#util#Execute('tabedit ' . fnameescape(a:filename))
|
||||||
else
|
else
|
||||||
call ale#util#Execute('edit ' . fnameescape(a:filename))
|
" Open another file only if we need to.
|
||||||
|
if bufnr(a:filename) isnot bufnr('')
|
||||||
|
call ale#util#Execute('edit ' . fnameescape(a:filename))
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call cursor(a:line, a:column)
|
call cursor(a:line, a:column)
|
||||||
|
@ -187,6 +187,28 @@ Execute(Other files should be jumped to for LSP definition responses):
|
|||||||
AssertEqual [3, 7], getpos('.')[1:2]
|
AssertEqual [3, 7], getpos('.')[1:2]
|
||||||
AssertEqual {}, ale#definition#GetMap()
|
AssertEqual {}, ale#definition#GetMap()
|
||||||
|
|
||||||
|
Execute(Locations inside the same file should be jumped to without using :edit):
|
||||||
|
call ale#definition#SetMap({3: {'open_in_tab': 0}})
|
||||||
|
call ale#definition#HandleLSPResponse(
|
||||||
|
\ 1,
|
||||||
|
\ {
|
||||||
|
\ 'id': 3,
|
||||||
|
\ 'result': {
|
||||||
|
\ 'uri': ale#path#ToURI(ale#path#Simplify(expand('%:p'))),
|
||||||
|
\ 'range': {
|
||||||
|
\ 'start': {'line': 2, 'character': 7},
|
||||||
|
\ },
|
||||||
|
\ },
|
||||||
|
\ }
|
||||||
|
\)
|
||||||
|
|
||||||
|
AssertEqual
|
||||||
|
\ [
|
||||||
|
\ ],
|
||||||
|
\ g:expr_list
|
||||||
|
AssertEqual [3, 7], getpos('.')[1:2]
|
||||||
|
AssertEqual {}, ale#definition#GetMap()
|
||||||
|
|
||||||
Execute(Other files should be jumped to in tabs for LSP definition responses):
|
Execute(Other files should be jumped to in tabs for LSP definition responses):
|
||||||
call ale#definition#SetMap({3: {'open_in_tab': 1}})
|
call ale#definition#SetMap({3: {'open_in_tab': 1}})
|
||||||
call ale#definition#HandleLSPResponse(
|
call ale#definition#HandleLSPResponse(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user