fix: check canRename before findRenameLocations
This commit is contained in:
parent
94b2772f8c
commit
8f712866cf
1 changed files with 4 additions and 0 deletions
|
@ -191,6 +191,10 @@ export function getJavaScriptMode(documentRegions: LanguageModelCache<HTMLDocume
|
|||
async doRename(document: TextDocument, position: Position, newName: string) {
|
||||
const jsDocument = jsDocuments.get(document);
|
||||
const jsLanguageService = await host.getLanguageService(jsDocument);
|
||||
const { canRename } = jsLanguageService.getRenameInfo(jsDocument.uri, jsDocument.offsetAt(position));
|
||||
if (!canRename) {
|
||||
return null;
|
||||
}
|
||||
const renameInfos = jsLanguageService.findRenameLocations(jsDocument.uri, jsDocument.offsetAt(position), false, false);
|
||||
|
||||
const edits: TextEdit[] = [];
|
||||
|
|
Loading…
Reference in a new issue