mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-20 19:21:18 +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:
@@ -368,7 +368,7 @@ Execute(ALEImport should request imports correctly for language servers):
|
||||
AssertEqual
|
||||
\ [
|
||||
\ [0, 'textDocument/completion', {
|
||||
\ 'textDocument': {'uri': ale#path#ToURI(expand('%:p'))},
|
||||
\ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))},
|
||||
\ 'position': {'character': 6, 'line': 1}
|
||||
\ }],
|
||||
\ ],
|
||||
@@ -514,7 +514,7 @@ Execute(ALEImport should tell the user when no completions were found from a lan
|
||||
AssertEqual
|
||||
\ [
|
||||
\ [0, 'textDocument/completion', {
|
||||
\ 'textDocument': {'uri': ale#path#ToURI(expand('%:p'))},
|
||||
\ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))},
|
||||
\ 'position': {'character': 6, 'line': 1}
|
||||
\ }],
|
||||
\ ],
|
||||
|
||||
@@ -233,13 +233,13 @@ Execute(The right message should be sent for the initial LSP request):
|
||||
\ [
|
||||
\ [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"}]
|
||||
\ }],
|
||||
\ [0, 'textDocument/completion', {
|
||||
\ 'textDocument': {'uri': ale#path#ToURI(expand('%:p'))},
|
||||
\ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))},
|
||||
\ 'position': {'line': 0, 'character': 2},
|
||||
\ }],
|
||||
\ ],
|
||||
@@ -294,13 +294,13 @@ Execute(Two completion requests shouldn't be sent in a row):
|
||||
\ [
|
||||
\ [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"}]
|
||||
\ }],
|
||||
\ [0, 'textDocument/completion', {
|
||||
\ 'textDocument': {'uri': ale#path#ToURI(expand('%:p'))},
|
||||
\ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))},
|
||||
\ 'position': {'line': 0, 'character': 2},
|
||||
\ }],
|
||||
\ ],
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -511,7 +511,7 @@ Execute(LSP code action requests should be sent):
|
||||
\ 'diagnostics': [{'range': {'end': {'character': 6, 'line': 1}, 'start': {'character': 4, 'line': 1}}, 'code': 2304, 'message': 'oops'}]
|
||||
\ },
|
||||
\ 'range': {'end': {'character': 5, 'line': 1}, 'start': {'character': 4, 'line': 1}},
|
||||
\ 'textDocument': {'uri': ale#path#ToURI(expand('%:p'))}
|
||||
\ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))}
|
||||
\ }]
|
||||
\ ],
|
||||
\ g:message_list[-1:]
|
||||
@@ -543,7 +543,7 @@ Execute(LSP code action requests should be sent only for error with code):
|
||||
\ 'diagnostics': [{'range': {'end': {'character': 6, 'line': 1}, 'start': {'character': 4, 'line': 1}}, 'code': 2304, 'message': 'oops'}]
|
||||
\ },
|
||||
\ 'range': {'end': {'character': 5, 'line': 1}, 'start': {'character': 4, 'line': 1}},
|
||||
\ 'textDocument': {'uri': ale#path#ToURI(expand('%:p'))}
|
||||
\ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))}
|
||||
\ }]
|
||||
\ ],
|
||||
\ g:message_list[-1:]
|
||||
|
||||
@@ -357,13 +357,13 @@ Execute(LSP reference responses should be handled):
|
||||
\ 'id': 3,
|
||||
\ 'result': [
|
||||
\ {
|
||||
\ 'uri': ale#path#ToURI(ale#path#Simplify(g:dir . '/completion_dummy_file')),
|
||||
\ 'uri': ale#path#ToFileURI(ale#path#Simplify(g:dir . '/completion_dummy_file')),
|
||||
\ 'range': {
|
||||
\ 'start': {'line': 2, 'character': 7},
|
||||
\ },
|
||||
\ },
|
||||
\ {
|
||||
\ 'uri': ale#path#ToURI(ale#path#Simplify(g:dir . '/other_file')),
|
||||
\ 'uri': ale#path#ToFileURI(ale#path#Simplify(g:dir . '/other_file')),
|
||||
\ 'range': {
|
||||
\ 'start': {'line': 7, 'character': 15},
|
||||
\ },
|
||||
@@ -396,13 +396,13 @@ Execute(LSP reference responses should be put to quickfix):
|
||||
\ 'id': 3,
|
||||
\ 'result': [
|
||||
\ {
|
||||
\ 'uri': ale#path#ToURI(ale#path#Simplify(g:dir . '/completion_dummy_file')),
|
||||
\ 'uri': ale#path#ToFileURI(ale#path#Simplify(g:dir . '/completion_dummy_file')),
|
||||
\ 'range': {
|
||||
\ 'start': {'line': 2, 'character': 7},
|
||||
\ },
|
||||
\ },
|
||||
\ {
|
||||
\ 'uri': ale#path#ToURI(ale#path#Simplify(g:dir . '/other_file')),
|
||||
\ 'uri': ale#path#ToFileURI(ale#path#Simplify(g:dir . '/other_file')),
|
||||
\ 'range': {
|
||||
\ 'start': {'line': 7, 'character': 15},
|
||||
\ },
|
||||
@@ -453,13 +453,13 @@ Execute(LSP reference requests should be sent):
|
||||
\ [
|
||||
\ [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"}]
|
||||
\ }],
|
||||
\ [0, 'textDocument/references', {
|
||||
\ 'textDocument': {'uri': ale#path#ToURI(expand('%:p'))},
|
||||
\ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))},
|
||||
\ 'position': {'line': 0, 'character': 2},
|
||||
\ 'context': {'includeDeclaration': v:false},
|
||||
\ }],
|
||||
|
||||
@@ -327,7 +327,7 @@ Execute(Other files should be jumped to for LSP definition responses):
|
||||
\ {
|
||||
\ 'id': 3,
|
||||
\ 'result': {
|
||||
\ 'uri': ale#path#ToURI(ale#path#Simplify(g:dir . '/completion_dummy_file')),
|
||||
\ 'uri': ale#path#ToFileURI(ale#path#Simplify(g:dir . '/completion_dummy_file')),
|
||||
\ 'range': {
|
||||
\ 'start': {'line': 2, 'character': 7},
|
||||
\ },
|
||||
@@ -350,7 +350,7 @@ Execute(Newer LocationLink items should be supported):
|
||||
\ {
|
||||
\ 'id': 3,
|
||||
\ 'result': {
|
||||
\ 'targetUri': ale#path#ToURI(ale#path#Simplify(g:dir . '/completion_dummy_file')),
|
||||
\ 'targetUri': ale#path#ToFileURI(ale#path#Simplify(g:dir . '/completion_dummy_file')),
|
||||
\ 'targetRange': {
|
||||
\ 'start': {'line': 2, 'character': 7},
|
||||
\ },
|
||||
@@ -373,7 +373,7 @@ Execute(Locations inside the same file should be jumped to without using :edit):
|
||||
\ {
|
||||
\ 'id': 3,
|
||||
\ 'result': {
|
||||
\ 'uri': ale#path#ToURI(ale#path#Simplify(expand('%:p'))),
|
||||
\ 'uri': ale#path#ToFileURI(ale#path#Simplify(expand('%:p'))),
|
||||
\ 'range': {
|
||||
\ 'start': {'line': 2, 'character': 7},
|
||||
\ },
|
||||
@@ -395,7 +395,7 @@ Execute(Other files should be jumped to in tabs for LSP definition responses):
|
||||
\ {
|
||||
\ 'id': 3,
|
||||
\ 'result': {
|
||||
\ 'uri': ale#path#ToURI(ale#path#Simplify(g:dir . '/completion_dummy_file')),
|
||||
\ 'uri': ale#path#ToFileURI(ale#path#Simplify(g:dir . '/completion_dummy_file')),
|
||||
\ 'range': {
|
||||
\ 'start': {'line': 2, 'character': 7},
|
||||
\ },
|
||||
@@ -419,13 +419,13 @@ Execute(Definition responses with lists should be handled):
|
||||
\ 'id': 3,
|
||||
\ 'result': [
|
||||
\ {
|
||||
\ 'uri': ale#path#ToURI(ale#path#Simplify(g:dir . '/completion_dummy_file')),
|
||||
\ 'uri': ale#path#ToFileURI(ale#path#Simplify(g:dir . '/completion_dummy_file')),
|
||||
\ 'range': {
|
||||
\ 'start': {'line': 2, 'character': 7},
|
||||
\ },
|
||||
\ },
|
||||
\ {
|
||||
\ 'uri': ale#path#ToURI(ale#path#Simplify(g:dir . '/other_file')),
|
||||
\ 'uri': ale#path#ToFileURI(ale#path#Simplify(g:dir . '/other_file')),
|
||||
\ 'range': {
|
||||
\ 'start': {'line': 20, 'character': 3},
|
||||
\ },
|
||||
@@ -470,13 +470,13 @@ Execute(LSP definition requests should be sent):
|
||||
\ [
|
||||
\ [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"}]
|
||||
\ }],
|
||||
\ [0, 'textDocument/definition', {
|
||||
\ 'textDocument': {'uri': ale#path#ToURI(expand('%:p'))},
|
||||
\ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))},
|
||||
\ 'position': {'line': 0, 'character': 2},
|
||||
\ }],
|
||||
\ ],
|
||||
@@ -506,13 +506,13 @@ Execute(LSP type definition requests should be sent):
|
||||
\ [
|
||||
\ [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"}]
|
||||
\ }],
|
||||
\ [0, 'textDocument/typeDefinition', {
|
||||
\ 'textDocument': {'uri': ale#path#ToURI(expand('%:p'))},
|
||||
\ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))},
|
||||
\ 'position': {'line': 0, 'character': 2},
|
||||
\ }],
|
||||
\ ],
|
||||
@@ -542,13 +542,13 @@ Execute(LSP tab definition requests should be sent):
|
||||
\ [
|
||||
\ [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"}]
|
||||
\ }],
|
||||
\ [0, 'textDocument/definition', {
|
||||
\ 'textDocument': {'uri': ale#path#ToURI(expand('%:p'))},
|
||||
\ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))},
|
||||
\ 'position': {'line': 0, 'character': 2},
|
||||
\ }],
|
||||
\ ],
|
||||
@@ -578,13 +578,13 @@ Execute(LSP tab type definition requests should be sent):
|
||||
\ [
|
||||
\ [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"}]
|
||||
\ }],
|
||||
\ [0, 'textDocument/typeDefinition', {
|
||||
\ 'textDocument': {'uri': ale#path#ToURI(expand('%:p'))},
|
||||
\ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))},
|
||||
\ 'position': {'line': 0, 'character': 2},
|
||||
\ }],
|
||||
\ ],
|
||||
|
||||
@@ -271,7 +271,7 @@ Execute(Buffer ignore lists should be applied for LSP linters):
|
||||
\ 'jsonrpc': '2.0',
|
||||
\ 'method': 'textDocument/publishDiagnostics',
|
||||
\ 'params': {
|
||||
\ 'uri': ale#path#ToURI(expand('%:p')),
|
||||
\ 'uri': ale#path#ToFileURI(expand('%:p')),
|
||||
\ 'diagnostics': [
|
||||
\ {
|
||||
\ 'severity': 1,
|
||||
@@ -366,7 +366,7 @@ Execute(ale_disable_lsp should be applied for LSP linters):
|
||||
\ 'jsonrpc': '2.0',
|
||||
\ 'method': 'textDocument/publishDiagnostics',
|
||||
\ 'params': {
|
||||
\ 'uri': ale#path#ToURI(expand('%:p')),
|
||||
\ 'uri': ale#path#ToFileURI(expand('%:p')),
|
||||
\ 'diagnostics': [
|
||||
\ {
|
||||
\ 'severity': 1,
|
||||
|
||||
@@ -1,73 +1,73 @@
|
||||
Before:
|
||||
scriptencoding utf-8
|
||||
|
||||
Execute(ale#path#ToURI should work for Windows paths):
|
||||
AssertEqual 'file:///C:/foo/bar/baz.tst', ale#path#ToURI('C:\foo\bar\baz.tst')
|
||||
AssertEqual 'foo/bar/baz.tst', ale#path#ToURI('foo\bar\baz.tst')
|
||||
Execute(ale#path#ToFileURI should work for Windows paths):
|
||||
AssertEqual 'file:///C:/foo/bar/baz.tst', ale#path#ToFileURI('C:\foo\bar\baz.tst')
|
||||
AssertEqual 'foo/bar/baz.tst', ale#path#ToFileURI('foo\bar\baz.tst')
|
||||
|
||||
Execute(ale#path#FromURI should work for Unix paths):
|
||||
AssertEqual '/foo/bar/baz.tst', ale#path#FromURI('file:///foo/bar/baz.tst')
|
||||
AssertEqual '/foo/bar/baz.tst', ale#path#FromURI('file:/foo/bar/baz.tst')
|
||||
AssertEqual '/foo/bar/baz.tst', ale#path#FromURI('FILE:///foo/bar/baz.tst')
|
||||
AssertEqual '/foo/bar/baz.tst', ale#path#FromURI('FILE:/foo/bar/baz.tst')
|
||||
Execute(ale#path#FromFileURI should work for Unix paths):
|
||||
AssertEqual '/foo/bar/baz.tst', ale#path#FromFileURI('file:///foo/bar/baz.tst')
|
||||
AssertEqual '/foo/bar/baz.tst', ale#path#FromFileURI('file:/foo/bar/baz.tst')
|
||||
AssertEqual '/foo/bar/baz.tst', ale#path#FromFileURI('FILE:///foo/bar/baz.tst')
|
||||
AssertEqual '/foo/bar/baz.tst', ale#path#FromFileURI('FILE:/foo/bar/baz.tst')
|
||||
|
||||
Execute(ale#path#FromURI should work for Windows paths):
|
||||
Execute(ale#path#FromFileURI should work for Windows paths):
|
||||
if has('win32')
|
||||
AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromURI('file:///C:/foo/bar/baz.tst')
|
||||
AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromURI('file:/C:/foo/bar/baz.tst')
|
||||
AssertEqual 'c:\foo\bar\baz.tst', ale#path#FromURI('file:///c:/foo/bar/baz.tst')
|
||||
AssertEqual 'c:\foo\bar\baz.tst', ale#path#FromURI('file:/c:/foo/bar/baz.tst')
|
||||
AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromURI('FILE:///C:/foo/bar/baz.tst')
|
||||
AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromURI('FILE:/C:/foo/bar/baz.tst')
|
||||
AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromFileURI('file:///C:/foo/bar/baz.tst')
|
||||
AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromFileURI('file:/C:/foo/bar/baz.tst')
|
||||
AssertEqual 'c:\foo\bar\baz.tst', ale#path#FromFileURI('file:///c:/foo/bar/baz.tst')
|
||||
AssertEqual 'c:\foo\bar\baz.tst', ale#path#FromFileURI('file:/c:/foo/bar/baz.tst')
|
||||
AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromFileURI('FILE:///C:/foo/bar/baz.tst')
|
||||
AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromFileURI('FILE:/C:/foo/bar/baz.tst')
|
||||
else
|
||||
AssertEqual '/C:/foo/bar/baz.tst', ale#path#FromURI('file:///C:/foo/bar/baz.tst')
|
||||
AssertEqual '/C:/foo/bar/baz.tst', ale#path#FromURI('file:/C:/foo/bar/baz.tst')
|
||||
AssertEqual '/c:/foo/bar/baz.tst', ale#path#FromURI('file:///c:/foo/bar/baz.tst')
|
||||
AssertEqual '/c:/foo/bar/baz.tst', ale#path#FromURI('file:/c:/foo/bar/baz.tst')
|
||||
AssertEqual '/C:/foo/bar/baz.tst', ale#path#FromURI('FILE:///C:/foo/bar/baz.tst')
|
||||
AssertEqual '/C:/foo/bar/baz.tst', ale#path#FromURI('FILE:/C:/foo/bar/baz.tst')
|
||||
AssertEqual '/C:/foo/bar/baz.tst', ale#path#FromFileURI('file:///C:/foo/bar/baz.tst')
|
||||
AssertEqual '/C:/foo/bar/baz.tst', ale#path#FromFileURI('file:/C:/foo/bar/baz.tst')
|
||||
AssertEqual '/c:/foo/bar/baz.tst', ale#path#FromFileURI('file:///c:/foo/bar/baz.tst')
|
||||
AssertEqual '/c:/foo/bar/baz.tst', ale#path#FromFileURI('file:/c:/foo/bar/baz.tst')
|
||||
AssertEqual '/C:/foo/bar/baz.tst', ale#path#FromFileURI('FILE:///C:/foo/bar/baz.tst')
|
||||
AssertEqual '/C:/foo/bar/baz.tst', ale#path#FromFileURI('FILE:/C:/foo/bar/baz.tst')
|
||||
endif
|
||||
|
||||
Execute(ale#path#FromURI parse Windows paths with a pipe):
|
||||
Execute(ale#path#FromFileURI parse Windows paths with a pipe):
|
||||
if has('win32')
|
||||
AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromURI('file:///C|/foo/bar/baz.tst')
|
||||
AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromURI('file:/C|/foo/bar/baz.tst')
|
||||
AssertEqual 'c:\foo\bar\baz.tst', ale#path#FromURI('file:///c|/foo/bar/baz.tst')
|
||||
AssertEqual 'c:\foo\bar\baz.tst', ale#path#FromURI('file:/c|/foo/bar/baz.tst')
|
||||
AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromURI('FILE:///C|/foo/bar/baz.tst')
|
||||
AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromURI('FILE:/C|/foo/bar/baz.tst')
|
||||
AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromFileURI('file:///C|/foo/bar/baz.tst')
|
||||
AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromFileURI('file:/C|/foo/bar/baz.tst')
|
||||
AssertEqual 'c:\foo\bar\baz.tst', ale#path#FromFileURI('file:///c|/foo/bar/baz.tst')
|
||||
AssertEqual 'c:\foo\bar\baz.tst', ale#path#FromFileURI('file:/c|/foo/bar/baz.tst')
|
||||
AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromFileURI('FILE:///C|/foo/bar/baz.tst')
|
||||
AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromFileURI('FILE:/C|/foo/bar/baz.tst')
|
||||
else
|
||||
AssertEqual '/C|/foo/bar/baz.tst', ale#path#FromURI('file:///C|/foo/bar/baz.tst')
|
||||
AssertEqual '/C|/foo/bar/baz.tst', ale#path#FromURI('file:/C|/foo/bar/baz.tst')
|
||||
AssertEqual '/c|/foo/bar/baz.tst', ale#path#FromURI('file:///c|/foo/bar/baz.tst')
|
||||
AssertEqual '/c|/foo/bar/baz.tst', ale#path#FromURI('file:/c|/foo/bar/baz.tst')
|
||||
AssertEqual '/C|/foo/bar/baz.tst', ale#path#FromURI('FILE:///C|/foo/bar/baz.tst')
|
||||
AssertEqual '/C|/foo/bar/baz.tst', ale#path#FromURI('FILE:/C|/foo/bar/baz.tst')
|
||||
AssertEqual '/C|/foo/bar/baz.tst', ale#path#FromFileURI('file:///C|/foo/bar/baz.tst')
|
||||
AssertEqual '/C|/foo/bar/baz.tst', ale#path#FromFileURI('file:/C|/foo/bar/baz.tst')
|
||||
AssertEqual '/c|/foo/bar/baz.tst', ale#path#FromFileURI('file:///c|/foo/bar/baz.tst')
|
||||
AssertEqual '/c|/foo/bar/baz.tst', ale#path#FromFileURI('file:/c|/foo/bar/baz.tst')
|
||||
AssertEqual '/C|/foo/bar/baz.tst', ale#path#FromFileURI('FILE:///C|/foo/bar/baz.tst')
|
||||
AssertEqual '/C|/foo/bar/baz.tst', ale#path#FromFileURI('FILE:/C|/foo/bar/baz.tst')
|
||||
endif
|
||||
|
||||
Execute(ale#path#FromURI should handle the colon for the drive letter being encoded):
|
||||
Execute(ale#path#FromFileURI should handle the colon for the drive letter being encoded):
|
||||
" These URIs shouldn't be created, but we'll handle them anyway.
|
||||
if has('win32')
|
||||
AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromURI('file:///C%3A/foo/bar/baz.tst')
|
||||
AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromFileURI('file:///C%3A/foo/bar/baz.tst')
|
||||
else
|
||||
AssertEqual '/C:/foo/bar/baz.tst', ale#path#FromURI('file:///C%3A/foo/bar/baz.tst')
|
||||
AssertEqual '/C:/foo/bar/baz.tst', ale#path#FromFileURI('file:///C%3A/foo/bar/baz.tst')
|
||||
endif
|
||||
|
||||
Execute(ale#path#ToURI should work for Unix paths):
|
||||
AssertEqual 'file:///foo/bar/baz.tst', ale#path#ToURI('/foo/bar/baz.tst')
|
||||
AssertEqual 'foo/bar/baz.tst', ale#path#ToURI('foo/bar/baz.tst')
|
||||
Execute(ale#path#ToFileURI should work for Unix paths):
|
||||
AssertEqual 'file:///foo/bar/baz.tst', ale#path#ToFileURI('/foo/bar/baz.tst')
|
||||
AssertEqual 'foo/bar/baz.tst', ale#path#ToFileURI('foo/bar/baz.tst')
|
||||
|
||||
Execute(ale#path#ToURI should keep safe characters):
|
||||
AssertEqual '//a-zA-Z0-9$-_.!*''(),', ale#path#ToURI('\/a-zA-Z0-9$-_.!*''(),')
|
||||
Execute(ale#path#ToFileURI should keep safe characters):
|
||||
AssertEqual '//a-zA-Z0-9$-_.!*''(),', ale#path#ToFileURI('\/a-zA-Z0-9$-_.!*''(),')
|
||||
|
||||
Execute(ale#path#ToURI should percent encode unsafe characters):
|
||||
AssertEqual '%20%2b%3a%3f%26%3d', ale#path#ToURI(' +:?&=')
|
||||
Execute(ale#path#ToFileURI should percent encode unsafe characters):
|
||||
AssertEqual '%20%2b%3a%3f%26%3d', ale#path#ToFileURI(' +:?&=')
|
||||
|
||||
Execute(ale#path#FromURI should decode percent encodings):
|
||||
AssertEqual ' +:?&=', ale#path#FromURI('%20%2b%3a%3f%26%3d')
|
||||
Execute(ale#path#FromFileURI should decode percent encodings):
|
||||
AssertEqual ' +:?&=', ale#path#FromFileURI('%20%2b%3a%3f%26%3d')
|
||||
|
||||
Execute(ale#path#ToURI should handle UTF-8):
|
||||
AssertEqual 'file:///T%c3%a9l%c3%a9chargement', ale#path#ToURI('/Téléchargement')
|
||||
Execute(ale#path#ToFileURI should handle UTF-8):
|
||||
AssertEqual 'file:///T%c3%a9l%c3%a9chargement', ale#path#ToFileURI('/Téléchargement')
|
||||
|
||||
Execute(ale#path#FromURI should handle UTF-8):
|
||||
AssertEqual '/Téléchargement', ale#path#FromURI('file:///T%C3%A9l%C3%A9chargement')
|
||||
Execute(ale#path#FromFileURI should handle UTF-8):
|
||||
AssertEqual '/Téléchargement', ale#path#FromFileURI('file:///T%C3%A9l%C3%A9chargement')
|
||||
|
||||
@@ -487,13 +487,13 @@ Execute(LSP rename requests should be sent):
|
||||
\ [
|
||||
\ [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"}]
|
||||
\ }],
|
||||
\ [0, 'textDocument/rename', {
|
||||
\ 'textDocument': {'uri': ale#path#ToURI(expand('%:p'))},
|
||||
\ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))},
|
||||
\ 'position': {'line': 0, 'character': 2},
|
||||
\ 'newName': 'a-new-name',
|
||||
\ }],
|
||||
|
||||
@@ -94,7 +94,7 @@ Execute(LSP symbol responses should be handled):
|
||||
\ {
|
||||
\ 'name': 'foo',
|
||||
\ 'location': {
|
||||
\ 'uri': ale#path#ToURI(ale#path#Simplify(g:dir . '/completion_dummy_file')),
|
||||
\ 'uri': ale#path#ToFileURI(ale#path#Simplify(g:dir . '/completion_dummy_file')),
|
||||
\ 'range': {
|
||||
\ 'start': {'line': 2, 'character': 7},
|
||||
\ },
|
||||
@@ -103,7 +103,7 @@ Execute(LSP symbol responses should be handled):
|
||||
\ {
|
||||
\ 'name': 'foobar',
|
||||
\ 'location': {
|
||||
\ 'uri': ale#path#ToURI(ale#path#Simplify(g:dir . '/other_file')),
|
||||
\ 'uri': ale#path#ToFileURI(ale#path#Simplify(g:dir . '/other_file')),
|
||||
\ 'range': {
|
||||
\ 'start': {'line': 7, 'character': 15},
|
||||
\ },
|
||||
|
||||
Reference in New Issue
Block a user