mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 12:19:20 +00:00
Run safe for html selectionRange
This commit is contained in:
@@ -480,17 +480,19 @@ connection.onFoldingRanges((params, token) => {
|
||||
}, null, `Error while computing folding regions for ${params.textDocument.uri}`, token);
|
||||
});
|
||||
|
||||
connection.onRequest('$/textDocument/selectionRange', async (params) => {
|
||||
const document = documents.get(params.textDocument.uri);
|
||||
const position: Position = params.position;
|
||||
connection.onRequest('$/textDocument/selectionRange', async (params, token) => {
|
||||
return runSafe(() => {
|
||||
const document = documents.get(params.textDocument.uri);
|
||||
const position: Position = params.position;
|
||||
|
||||
if (document) {
|
||||
const htmlMode = languageModes.getMode('html');
|
||||
if (htmlMode && htmlMode.doSelection) {
|
||||
return htmlMode.doSelection(document, position);
|
||||
if (document) {
|
||||
const htmlMode = languageModes.getMode('html');
|
||||
if (htmlMode && htmlMode.doSelection) {
|
||||
return htmlMode.doSelection(document, position);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Promise.resolve(null);
|
||||
return Promise.resolve(null);
|
||||
}, null, `Error while computing selection ranges for ${params.textDocument.uri}`, token);
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user