[json] enable semantic selection

This commit is contained in:
Martin Aeschlimann
2019-01-28 16:05:18 +01:00
parent 37fbae08a4
commit 21585312c2
12 changed files with 46 additions and 2296 deletions

View File

@@ -427,5 +427,16 @@ connection.onFoldingRanges((params, token) => {
}, null, `Error while computing folding ranges for ${params.textDocument.uri}`, token);
});
connection.onRequest('$/textDocument/selectionRange', async (params, token) => {
return runSafe(() => {
const document = documents.get(params.textDocument.uri);
if (document) {
const jsonDocument = getJSONDocument(document);
return languageService.getSelectionRanges(document, params.position, jsonDocument);
}
return [];
}, [], `Error while computing selection ranges for ${params.textDocument.uri}`, token);
});
// Listen on the connection
connection.listen();