summaryrefslogtreecommitdiff
path: root/test/test_go_to_definition.vader
diff options
context:
space:
mode:
authorgodbless <26397224+sak96@users.noreply.github.com>2022-04-30 08:58:26 +0530
committerGitHub <noreply@github.com>2022-04-30 12:28:26 +0900
commitd484347fb5f63cd5d4d4da7bf1ba4fc197f668eb (patch)
treed9c5d83af7f595bb9d05e015935558d63aa6708c /test/test_go_to_definition.vader
parent57e16957e0e4c4293603bffc5014dc6bc72e9256 (diff)
downloadale-d484347fb5f63cd5d4d4da7bf1ba4fc197f668eb.zip
Add ALEGoToImplementation (#4160)
* Add go to implementation * Add test cases for GoToImplementation * Add documentation for GoToImplementation
Diffstat (limited to 'test/test_go_to_definition.vader')
-rw-r--r--test/test_go_to_definition.vader96
1 files changed, 96 insertions, 0 deletions
diff --git a/test/test_go_to_definition.vader b/test/test_go_to_definition.vader
index fd2519b8..726de551 100644
--- a/test/test_go_to_definition.vader
+++ b/test/test_go_to_definition.vader
@@ -266,6 +266,30 @@ Execute(tsserver type definition requests should be sent):
\ g:message_list
AssertEqual {'42': {'open_in': 'current-buffer'}}, ale#definition#GetMap()
+Execute(tsserver implementation requests should be sent):
+ runtime ale_linters/typescript/tsserver.vim
+ call setpos('.', [bufnr(''), 2, 5, 0])
+
+ ALEGoToImplementation
+
+ " We shouldn't register the callback yet.
+ AssertEqual '''''', string(g:Callback)
+
+ AssertEqual type(function('type')), type(g:InitCallback)
+ call g:InitCallback()
+
+ AssertEqual 'implementation', g:capability_checked
+ AssertEqual
+ \ 'function(''ale#definition#HandleTSServerResponse'')',
+ \ string(g:Callback)
+ AssertEqual
+ \ [
+ \ ale#lsp#tsserver_message#Change(bufnr('')),
+ \ [0, 'ts@implementation', {'file': expand('%:p'), 'line': 2, 'offset': 5}]
+ \ ],
+ \ g:message_list
+ AssertEqual {'42': {'open_in': 'current-buffer'}}, ale#definition#GetMap()
+
Execute(tsserver tab definition requests should be sent):
runtime ale_linters/typescript/tsserver.vim
call setpos('.', [bufnr(''), 2, 5, 0])
@@ -520,6 +544,42 @@ Execute(LSP type definition requests should be sent):
AssertEqual {'42': {'open_in': 'current-buffer'}}, ale#definition#GetMap()
+Execute(LSP implementation requests should be sent):
+ runtime ale_linters/python/pylsp.vim
+ let b:ale_linters = ['pylsp']
+ call setpos('.', [bufnr(''), 1, 5, 0])
+
+ ALEGoToImplementation
+
+ " We shouldn't register the callback yet.
+ AssertEqual '''''', string(g:Callback)
+
+ AssertEqual type(function('type')), type(g:InitCallback)
+ call g:InitCallback()
+
+ AssertEqual 'implementation', g:capability_checked
+ AssertEqual
+ \ 'function(''ale#definition#HandleLSPResponse'')',
+ \ string(g:Callback)
+
+ AssertEqual
+ \ [
+ \ [1, 'textDocument/didChange', {
+ \ 'textDocument': {
+ \ 'uri': ale#path#ToFileURI(expand('%:p')),
+ \ 'version': g:ale_lsp_next_version_id - 1,
+ \ },
+ \ 'contentChanges': [{'text': join(getline(1, '$'), "\n") . "\n"}]
+ \ }],
+ \ [0, 'textDocument/implementation', {
+ \ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))},
+ \ 'position': {'line': 0, 'character': 2},
+ \ }],
+ \ ],
+ \ g:message_list
+
+ AssertEqual {'42': {'open_in': 'current-buffer'}}, ale#definition#GetMap()
+
Execute(LSP tab definition requests should be sent):
runtime ale_linters/python/pylsp.vim
let b:ale_linters = ['pylsp']
@@ -591,3 +651,39 @@ Execute(LSP tab type definition requests should be sent):
\ g:message_list
AssertEqual {'42': {'open_in': 'tab'}}, ale#definition#GetMap()
+
+Execute(LSP tab implementation requests should be sent):
+ runtime ale_linters/python/pylsp.vim
+ let b:ale_linters = ['pylsp']
+ call setpos('.', [bufnr(''), 1, 5, 0])
+
+ ALEGoToImplementation -tab
+
+ " We shouldn't register the callback yet.
+ AssertEqual '''''', string(g:Callback)
+
+ AssertEqual type(function('type')), type(g:InitCallback)
+ call g:InitCallback()
+
+ AssertEqual 'implementation', g:capability_checked
+ AssertEqual
+ \ 'function(''ale#definition#HandleLSPResponse'')',
+ \ string(g:Callback)
+
+ AssertEqual
+ \ [
+ \ [1, 'textDocument/didChange', {
+ \ 'textDocument': {
+ \ 'uri': ale#path#ToFileURI(expand('%:p')),
+ \ 'version': g:ale_lsp_next_version_id - 1,
+ \ },
+ \ 'contentChanges': [{'text': join(getline(1, '$'), "\n") . "\n"}]
+ \ }],
+ \ [0, 'textDocument/implementation', {
+ \ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))},
+ \ 'position': {'line': 0, 'character': 2},
+ \ }],
+ \ ],
+ \ g:message_list
+
+ AssertEqual {'42': {'open_in': 'tab'}}, ale#definition#GetMap()