[json] use links for $ref, not goto definition (fixes #101474)

This commit is contained in:
Martin Aeschlimann 2020-11-03 22:30:33 +01:00
parent e934668bd0
commit 1c2005331c
3 changed files with 9 additions and 9 deletions

View file

@ -14,7 +14,7 @@
"dependencies": {
"jsonc-parser": "^2.2.1",
"request-light": "^0.3.0",
"vscode-json-languageservice": "^3.9.1",
"vscode-json-languageservice": "^3.10.0",
"vscode-languageserver": "7.0.0-next.3",
"vscode-uri": "^2.1.2"
},

View file

@ -141,7 +141,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
colorProvider: {},
foldingRangeProvider: true,
selectionRangeProvider: true,
definitionProvider: true
documentLinkProvider: {}
};
return { capabilities };
@ -481,15 +481,15 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
}, [], `Error while computing selection ranges for ${params.textDocument.uri}`, token);
});
connection.onDefinition((params, token) => {
connection.onDocumentLinks((params, token) => {
return runSafeAsync(async () => {
const document = documents.get(params.textDocument.uri);
if (document) {
const jsonDocument = getJSONDocument(document);
return languageService.findDefinition(document, params.position, jsonDocument);
return languageService.findLinks(document, jsonDocument);
}
return [];
}, [], `Error while computing definitions for ${params.textDocument.uri}`, token);
}, [], `Error while computing links for ${params.textDocument.uri}`, token);
});
// Listen on the connection

View file

@ -85,10 +85,10 @@ request-light@^0.3.0:
https-proxy-agent "^2.2.4"
vscode-nls "^4.1.1"
vscode-json-languageservice@^3.9.1:
version "3.9.1"
resolved "https://registry.yarnpkg.com/vscode-json-languageservice/-/vscode-json-languageservice-3.9.1.tgz#f72b581f8cd2bd9b47445ccf8b0ddcde6aba7483"
integrity sha512-oJkknkdCVitQ5XPSRa0weHjUxt8eSCptaL+MBQQlRsa6Nb8XnEY0S5wYnLUFHzEvKzwt01/LKk8LdOixWEXkNA==
vscode-json-languageservice@^3.10.0:
version "3.10.0"
resolved "https://registry.yarnpkg.com/vscode-json-languageservice/-/vscode-json-languageservice-3.10.0.tgz#19eed884fd0f234f8ed2fa0a96e772f293ccc5c4"
integrity sha512-8IvuRSQnjznu+obqy6Dy4S4H68Ke7a3Kb+A0FcdctyAMAWEnrORpCpMOMqEYiPLm/OTYLVWJ7ql3qToDTozu4w==
dependencies:
jsonc-parser "^2.3.1"
vscode-languageserver-textdocument "^1.0.1"