mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 12:19:20 +00:00
[json] Go to definition for $ref. Fixes #69411
This commit is contained in:
@@ -174,7 +174,8 @@ connection.onInitialize((params: InitializeParams): InitializeResult => {
|
||||
documentRangeFormattingProvider: params.initializationOptions.provideFormatter === true,
|
||||
colorProvider: {},
|
||||
foldingRangeProvider: true,
|
||||
selectionRangeProvider: true
|
||||
selectionRangeProvider: true,
|
||||
definitionProvider: true
|
||||
};
|
||||
|
||||
return { capabilities };
|
||||
@@ -516,5 +517,16 @@ connection.onSelectionRanges((params, token) => {
|
||||
}, [], `Error while computing selection ranges for ${params.textDocument.uri}`, token);
|
||||
});
|
||||
|
||||
connection.onDefinition((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 [];
|
||||
}, [], `Error while computing definitions for ${params.textDocument.uri}`, token);
|
||||
});
|
||||
|
||||
// Listen on the connection
|
||||
connection.listen();
|
||||
|
||||
Reference in New Issue
Block a user