mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-16 09:17:07 +08:00
Add eclipselsp jdt:// support for textDocument/definition (#4030)
This patch adds support for opening jdt:// links on "go to definition" requests returned by Java language servers. Co-authored-by: w0rp <devw0rp@gmail.com>
This commit is contained in:
@@ -63,7 +63,7 @@ Execute(A message should be sent if the document was opened):
|
||||
\ [
|
||||
\ ['command:/foo', 1, 'textDocument/didOpen', {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': ale#path#ToURI(expand('%:p')),
|
||||
\ 'uri': ale#path#ToFileURI(expand('%:p')),
|
||||
\ 'version': g:ale_lsp_next_version_id - 1,
|
||||
\ 'languageId': 'lang',
|
||||
\ 'text': "\n",
|
||||
@@ -71,7 +71,7 @@ Execute(A message should be sent if the document was opened):
|
||||
\ }],
|
||||
\ ['command:/foo', 1, 'textDocument/didClose', {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': ale#path#ToURI(expand('%:p')),
|
||||
\ 'uri': ale#path#ToFileURI(expand('%:p')),
|
||||
\ },
|
||||
\ }],
|
||||
\ ],
|
||||
@@ -106,7 +106,7 @@ Execute(Re-opening and closing the documents should work):
|
||||
\ [
|
||||
\ ['command:/foo', 1, 'textDocument/didOpen', {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': ale#path#ToURI(expand('%:p')),
|
||||
\ 'uri': ale#path#ToFileURI(expand('%:p')),
|
||||
\ 'version': g:ale_lsp_next_version_id - 2,
|
||||
\ 'languageId': 'lang',
|
||||
\ 'text': "\n",
|
||||
@@ -114,12 +114,12 @@ Execute(Re-opening and closing the documents should work):
|
||||
\ }],
|
||||
\ ['command:/foo', 1, 'textDocument/didClose', {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': ale#path#ToURI(expand('%:p')),
|
||||
\ 'uri': ale#path#ToFileURI(expand('%:p')),
|
||||
\ },
|
||||
\ }],
|
||||
\ ['command:/foo', 1, 'textDocument/didOpen', {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': ale#path#ToURI(expand('%:p')),
|
||||
\ 'uri': ale#path#ToFileURI(expand('%:p')),
|
||||
\ 'version': g:ale_lsp_next_version_id - 1,
|
||||
\ 'languageId': 'lang',
|
||||
\ 'text': "\n",
|
||||
@@ -127,7 +127,7 @@ Execute(Re-opening and closing the documents should work):
|
||||
\ }],
|
||||
\ ['command:/foo', 1, 'textDocument/didClose', {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': ale#path#ToURI(expand('%:p')),
|
||||
\ 'uri': ale#path#ToFileURI(expand('%:p')),
|
||||
\ },
|
||||
\ }],
|
||||
\ ],
|
||||
@@ -148,7 +148,7 @@ Execute(Messages for closing documents should be sent to each server):
|
||||
\ [
|
||||
\ ['command:/foo', 1, 'textDocument/didOpen', {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': ale#path#ToURI(expand('%:p')),
|
||||
\ 'uri': ale#path#ToFileURI(expand('%:p')),
|
||||
\ 'version': g:ale_lsp_next_version_id - 2,
|
||||
\ 'languageId': 'lang',
|
||||
\ 'text': "\n",
|
||||
@@ -156,7 +156,7 @@ Execute(Messages for closing documents should be sent to each server):
|
||||
\ }],
|
||||
\ ['command:/bar', 1, 'textDocument/didOpen', {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': ale#path#ToURI(expand('%:p')),
|
||||
\ 'uri': ale#path#ToFileURI(expand('%:p')),
|
||||
\ 'version': g:ale_lsp_next_version_id - 1,
|
||||
\ 'languageId': 'lang',
|
||||
\ 'text': "\n",
|
||||
@@ -164,12 +164,12 @@ Execute(Messages for closing documents should be sent to each server):
|
||||
\ }],
|
||||
\ ['command:/bar', 1, 'textDocument/didClose', {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': ale#path#ToURI(expand('%:p')),
|
||||
\ 'uri': ale#path#ToFileURI(expand('%:p')),
|
||||
\ },
|
||||
\ }],
|
||||
\ ['command:/foo', 1, 'textDocument/didClose', {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': ale#path#ToURI(expand('%:p')),
|
||||
\ 'uri': ale#path#ToFileURI(expand('%:p')),
|
||||
\ },
|
||||
\ }],
|
||||
\ ],
|
||||
|
||||
@@ -94,7 +94,7 @@ Execute(Server should be notified on save):
|
||||
\ [
|
||||
\ [1, 'textDocument/didChange', {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': ale#path#ToURI(expand('%:p')),
|
||||
\ 'uri': ale#path#ToFileURI(expand('%:p')),
|
||||
\ 'version': g:ale_lsp_next_version_id - 1,
|
||||
\ },
|
||||
\ 'contentChanges': [{'text': join(getline(1, '$'), "\n") . "\n"}],
|
||||
@@ -118,14 +118,14 @@ Execute(Server should be notified on save with didSave is supported by server):
|
||||
\ [
|
||||
\ [1, 'textDocument/didChange', {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': ale#path#ToURI(expand('%:p')),
|
||||
\ 'uri': ale#path#ToFileURI(expand('%:p')),
|
||||
\ 'version': g:ale_lsp_next_version_id - 1,
|
||||
\ },
|
||||
\ 'contentChanges': [{'text': join(getline(1, '$'), "\n") . "\n"}],
|
||||
\ }],
|
||||
\ [1, 'textDocument/didSave', {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': ale#path#ToURI(expand('%:p')),
|
||||
\ 'uri': ale#path#ToFileURI(expand('%:p')),
|
||||
\ },
|
||||
\ }],
|
||||
\ ],
|
||||
@@ -138,7 +138,7 @@ Execute(Server should be notified on change):
|
||||
\ [
|
||||
\ [1, 'textDocument/didChange', {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': ale#path#ToURI(expand('%:p')),
|
||||
\ 'uri': ale#path#ToFileURI(expand('%:p')),
|
||||
\ 'version': g:ale_lsp_next_version_id - 1,
|
||||
\ },
|
||||
\ 'contentChanges': [{'text': join(getline(1, '$'), "\n") . "\n"}],
|
||||
|
||||
@@ -314,7 +314,7 @@ Execute(LSP diagnostics responses should be handled correctly):
|
||||
\ 'jsonrpc':'2.0',
|
||||
\ 'method':'textDocument/publishDiagnostics',
|
||||
\ 'params': {
|
||||
\ 'uri': ale#path#ToURI(expand('%:p')),
|
||||
\ 'uri': ale#path#ToFileURI(expand('%:p')),
|
||||
\ 'diagnostics': [
|
||||
\ {
|
||||
\ 'range': {
|
||||
@@ -403,7 +403,7 @@ Execute(LSP errors should mark linters no longer active):
|
||||
call ale#lsp_linter#HandleLSPResponse(1, {
|
||||
\ 'method': 'textDocument/publishDiagnostics',
|
||||
\ 'params': {
|
||||
\ 'uri': ale#path#ToURI(g:dir . '/filename.py'),
|
||||
\ 'uri': ale#path#ToFileURI(g:dir . '/filename.py'),
|
||||
\ 'diagnostics': [],
|
||||
\ },
|
||||
\})
|
||||
|
||||
@@ -44,7 +44,7 @@ Execute(ale#lsp#message#DidOpen() should return correct messages):
|
||||
\ 'textDocument/didOpen',
|
||||
\ {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': ale#path#ToURI(g:dir . '/foo/bar.ts'),
|
||||
\ 'uri': ale#path#ToFileURI(g:dir . '/foo/bar.ts'),
|
||||
\ 'languageId': 'typescript',
|
||||
\ 'version': 12,
|
||||
\ 'text': "foo()\nbar()\nbaz()\n",
|
||||
@@ -62,7 +62,7 @@ Execute(ale#lsp#message#DidChange() should return correct messages):
|
||||
\ 'textDocument/didChange',
|
||||
\ {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': ale#path#ToURI(g:dir . '/foo/bar.ts'),
|
||||
\ 'uri': ale#path#ToFileURI(g:dir . '/foo/bar.ts'),
|
||||
\ 'version': 34,
|
||||
\ },
|
||||
\ 'contentChanges': [{'text': "foo()\nbar()\nbaz()\n"}],
|
||||
@@ -84,7 +84,7 @@ Execute(ale#lsp#message#DidSave() should return correct messages):
|
||||
\ 'textDocument/didSave',
|
||||
\ {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': ale#path#ToURI(g:dir . '/foo/bar.ts'),
|
||||
\ 'uri': ale#path#ToFileURI(g:dir . '/foo/bar.ts'),
|
||||
\ },
|
||||
\ }
|
||||
\ ],
|
||||
@@ -97,7 +97,7 @@ Execute(ale#lsp#message#DidSave() should return correct message with includeText
|
||||
\ 'textDocument/didSave',
|
||||
\ {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': ale#path#ToURI(g:dir . '/foo/bar.ts'),
|
||||
\ 'uri': ale#path#ToFileURI(g:dir . '/foo/bar.ts'),
|
||||
\ 'version': 1,
|
||||
\ },
|
||||
\ 'text': ale#util#GetBufferContents(bufnr('')),
|
||||
@@ -112,7 +112,7 @@ Execute(ale#lsp#message#DidClose() should return correct messages):
|
||||
\ 'textDocument/didClose',
|
||||
\ {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': ale#path#ToURI(g:dir . '/foo/bar.ts'),
|
||||
\ 'uri': ale#path#ToFileURI(g:dir . '/foo/bar.ts'),
|
||||
\ },
|
||||
\ }
|
||||
\ ],
|
||||
@@ -125,7 +125,7 @@ Execute(ale#lsp#message#Completion() should return correct messages):
|
||||
\ 'textDocument/completion',
|
||||
\ {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': ale#path#ToURI(g:dir . '/foo/bar.ts'),
|
||||
\ 'uri': ale#path#ToFileURI(g:dir . '/foo/bar.ts'),
|
||||
\ },
|
||||
\ 'position': {'line': 11, 'character': 33},
|
||||
\ }
|
||||
@@ -139,7 +139,7 @@ Execute(ale#lsp#message#Completion() should return correct messages with a trigg
|
||||
\ 'textDocument/completion',
|
||||
\ {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': ale#path#ToURI(g:dir . '/foo/bar.ts'),
|
||||
\ 'uri': ale#path#ToFileURI(g:dir . '/foo/bar.ts'),
|
||||
\ },
|
||||
\ 'position': {'line': 11, 'character': 33},
|
||||
\ 'context': {'triggerKind': 2, 'triggerCharacter': '.'},
|
||||
@@ -154,7 +154,7 @@ Execute(ale#lsp#message#Definition() should return correct messages):
|
||||
\ 'textDocument/definition',
|
||||
\ {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': ale#path#ToURI(g:dir . '/foo/bar.ts'),
|
||||
\ 'uri': ale#path#ToFileURI(g:dir . '/foo/bar.ts'),
|
||||
\ },
|
||||
\ 'position': {'line': 11, 'character': 33},
|
||||
\ }
|
||||
@@ -168,7 +168,7 @@ Execute(ale#lsp#message#TypeDefinition() should return correct messages):
|
||||
\ 'textDocument/typeDefinition',
|
||||
\ {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': ale#path#ToURI(g:dir . '/foo/bar.ts'),
|
||||
\ 'uri': ale#path#ToFileURI(g:dir . '/foo/bar.ts'),
|
||||
\ },
|
||||
\ 'position': {'line': 11, 'character': 33},
|
||||
\ }
|
||||
@@ -182,7 +182,7 @@ Execute(ale#lsp#message#References() should return correct messages):
|
||||
\ 'textDocument/references',
|
||||
\ {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': ale#path#ToURI(g:dir . '/foo/bar.ts'),
|
||||
\ 'uri': ale#path#ToFileURI(g:dir . '/foo/bar.ts'),
|
||||
\ },
|
||||
\ 'position': {'line': 11, 'character': 33},
|
||||
\ 'context': {'includeDeclaration': v:false},
|
||||
@@ -208,7 +208,7 @@ Execute(ale#lsp#message#Hover() should return correct messages):
|
||||
\ 'textDocument/hover',
|
||||
\ {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': ale#path#ToURI(g:dir . '/foo/bar.ts'),
|
||||
\ 'uri': ale#path#ToFileURI(g:dir . '/foo/bar.ts'),
|
||||
\ },
|
||||
\ 'position': {'line': 11, 'character': 33},
|
||||
\ }
|
||||
|
||||
@@ -138,7 +138,7 @@ Before:
|
||||
\ 'id': 1,
|
||||
\ 'params': {
|
||||
\ 'initializationOptions': {},
|
||||
\ 'rootUri': ale#path#ToURI(a:root),
|
||||
\ 'rootUri': ale#path#ToFileURI(a:root),
|
||||
\ 'rootPath': a:root,
|
||||
\ 'processId': getpid(),
|
||||
\ 'capabilities': {
|
||||
@@ -253,7 +253,7 @@ Before:
|
||||
\ 'jsonrpc': '2.0',
|
||||
\ 'params': {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')),
|
||||
\ 'uri': ale#path#ToFileURI(expand('#' . a:buffer . ':p')),
|
||||
\ 'version': ale#lsp#message#GetNextVersionID() - 1,
|
||||
\ 'languageId': a:language,
|
||||
\ 'text': "\n",
|
||||
|
||||
Reference in New Issue
Block a user