Skip to content

Commit

Permalink
Merge pull request dense-analysis#1797 from bradlarsen/master
Browse files Browse the repository at this point in the history
Additionally adjust the jumplist with line numbers when opening a new file
  • Loading branch information
w0rp committed Aug 7, 2018
2 parents 5f5540c + 8a9b28d commit 1a4456c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions autoload/ale/util.vim
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ endfunction

function! ale#util#Open(filename, line, column, options) abort
if get(a:options, 'open_in_tab', 0)
call ale#util#Execute('tabedit ' . fnameescape(a:filename))
call ale#util#Execute('tabedit +' . a:line . ' ' . fnameescape(a:filename))
elseif bufnr(a:filename) isnot bufnr('')
" Open another file only if we need to.
call ale#util#Execute('edit ' . fnameescape(a:filename))
call ale#util#Execute('edit +' . a:line . ' ' . fnameescape(a:filename))
else
normal! m`
endif
Expand Down
10 changes: 5 additions & 5 deletions test/test_go_to_definition.vader
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Execute(Other files should be jumped to for definition responses):

AssertEqual
\ [
\ 'edit ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')),
\ 'edit +3 ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')),
\ ],
\ g:expr_list
AssertEqual [3, 7], getpos('.')[1:2]
Expand All @@ -136,7 +136,7 @@ Execute(Other files should be jumped to for definition responses in tabs too):

AssertEqual
\ [
\ 'tabedit ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')),
\ 'tabedit +3 ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')),
\ ],
\ g:expr_list
AssertEqual [3, 7], getpos('.')[1:2]
Expand Down Expand Up @@ -206,7 +206,7 @@ Execute(Other files should be jumped to for LSP definition responses):

AssertEqual
\ [
\ 'edit ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')),
\ 'edit +3 ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')),
\ ],
\ g:expr_list
AssertEqual [3, 7], getpos('.')[1:2]
Expand Down Expand Up @@ -251,7 +251,7 @@ Execute(Other files should be jumped to in tabs for LSP definition responses):

AssertEqual
\ [
\ 'tabedit ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')),
\ 'tabedit +3 ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')),
\ ],
\ g:expr_list
AssertEqual [3, 7], getpos('.')[1:2]
Expand Down Expand Up @@ -282,7 +282,7 @@ Execute(Definition responses with lists should be handled):

AssertEqual
\ [
\ 'edit ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')),
\ 'edit +3 ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')),
\ ],
\ g:expr_list
AssertEqual [3, 7], getpos('.')[1:2]
Expand Down

0 comments on commit 1a4456c

Please sign in to comment.