mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 20:26:08 +00:00
Show better error when rename fails in md (#161525)
* Show better error when rename fails in md * Pick up latest MDLanguage service
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
"vscode-languageserver": "^8.0.2",
|
||||
"vscode-languageserver-textdocument": "^1.0.5",
|
||||
"vscode-languageserver-types": "^3.17.1",
|
||||
"vscode-markdown-languageservice": "^0.1.0-alpha.8",
|
||||
"vscode-markdown-languageservice": "^0.1.0-alpha.10",
|
||||
"vscode-nls": "^5.0.1",
|
||||
"vscode-uri": "^3.0.3"
|
||||
},
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { LsConfiguration } from 'vscode-markdown-languageservice/out/config';
|
||||
import { LsConfiguration } from 'vscode-markdown-languageservice';
|
||||
|
||||
export { LsConfiguration };
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { CancellationToken, Connection, InitializeParams, InitializeResult, NotebookDocuments, TextDocuments } from 'vscode-languageserver';
|
||||
import { CancellationToken, Connection, InitializeParams, InitializeResult, NotebookDocuments, ResponseError, TextDocuments } from 'vscode-languageserver';
|
||||
import { TextDocument } from 'vscode-languageserver-textdocument';
|
||||
import * as lsp from 'vscode-languageserver-types';
|
||||
import * as md from 'vscode-markdown-languageservice';
|
||||
@@ -170,7 +170,16 @@ export async function startServer(connection: Connection, serverConfig: {
|
||||
if (!document) {
|
||||
return undefined;
|
||||
}
|
||||
return mdLs!.prepareRename(document, params.position, token);
|
||||
|
||||
try {
|
||||
return await mdLs!.prepareRename(document, params.position, token);
|
||||
} catch (e) {
|
||||
if (e instanceof md.RenameNotSupportedAtLocationError) {
|
||||
throw new ResponseError(0, e.message);
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
connection.onRenameRequest(async (params, token) => {
|
||||
|
||||
@@ -42,10 +42,10 @@ vscode-languageserver@^8.0.2:
|
||||
dependencies:
|
||||
vscode-languageserver-protocol "3.17.2"
|
||||
|
||||
vscode-markdown-languageservice@^0.1.0-alpha.8:
|
||||
version "0.1.0-alpha.8"
|
||||
resolved "https://registry.yarnpkg.com/vscode-markdown-languageservice/-/vscode-markdown-languageservice-0.1.0-alpha.8.tgz#c9a3a8366f1f18776e74e2a2df65351c52328301"
|
||||
integrity sha512-rgjO3ZIO1ZH3DFGMQ6v7jXPz+LaV8SYo1Cuy9iIOanD9md4/jXRX16e62bgBdTFP+SAcCk6oKc5AqDqEMybAug==
|
||||
vscode-markdown-languageservice@^0.1.0-alpha.10:
|
||||
version "0.1.0-alpha.10"
|
||||
resolved "https://registry.yarnpkg.com/vscode-markdown-languageservice/-/vscode-markdown-languageservice-0.1.0-alpha.10.tgz#012dcf600b9d1a738cd7071f17627285342d17c7"
|
||||
integrity sha512-GZTxGZp49BIf/k5plc5x+Bp70kmwaTdt523p+wifG9AQ0uKMSRcwmlKu8mOcJUd0ZvDR3ORI/Cze90Dy5HCM2A==
|
||||
dependencies:
|
||||
picomatch "^2.3.1"
|
||||
vscode-languageserver-textdocument "^1.0.5"
|
||||
|
||||
Reference in New Issue
Block a user