summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2018-08-07 21:57:12 +0100
committerGitHub <noreply@github.com>2018-08-07 21:57:12 +0100
commit1a4456cf2ab6be682e87c4d8c9811c73e69c1b65 (patch)
treeef0de4727de30d55aacad7406af1b847afcee53a
parent5f5540c574deead932a7785468899d1d0a8540ce (diff)
parent8a9b28daf913eb72ca78409c4454ec7e3883e51a (diff)
downloadale-1a4456cf2ab6be682e87c4d8c9811c73e69c1b65.zip
Merge pull request #1797 from bradlarsen/masterv2.1.0
Additionally adjust the jumplist with line numbers when opening a new file
-rw-r--r--autoload/ale/util.vim4
-rw-r--r--test/test_go_to_definition.vader10
2 files changed, 7 insertions, 7 deletions
diff --git a/autoload/ale/util.vim b/autoload/ale/util.vim
index be37d1b5..e9b5688d 100644
--- a/autoload/ale/util.vim
+++ b/autoload/ale/util.vim
@@ -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
diff --git a/test/test_go_to_definition.vader b/test/test_go_to_definition.vader
index 7f0e3fcb..53f566e9 100644
--- a/test/test_go_to_definition.vader
+++ b/test/test_go_to_definition.vader
@@ -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]
@@ -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]
@@ -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]
@@ -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]
@@ -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]