Skip to content

Commit 4ed6d8b

Browse files
author
Simon Holthausen
committed
(fix) prevent renames in error state
1 parent d201546 commit 4ed6d8b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/language-server/src/plugins/typescript/features/RenameProvider.ts

+7
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ export class RenameProviderImpl implements RenameProvider {
110110
fullDisplayName: string;
111111
triggerSpan: { start: number; length: number };
112112
} | null {
113+
// Don't allow renames in error-state, because then there is no generated svelte2tsx-code
114+
// and rename cannot work
115+
if (tsDoc.parserError) {
116+
return null;
117+
}
113118
const renameInfo: any = lang.getRenameInfo(tsDoc.filePath, offset, {
114119
allowRenameOfImportPath: false,
115120
});
@@ -215,6 +220,7 @@ export class RenameProviderImpl implements RenameProvider {
215220
return await this.mapRenameLocationsToParent(replacementsForProp, fragments);
216221
}
217222

223+
// --------> svelte2tsx?
218224
private matchGeneratedExportLet(
219225
fragment: SvelteSnapshotFragment,
220226
updatePropLocation: ts.RenameLocation,
@@ -250,6 +256,7 @@ export class RenameProviderImpl implements RenameProvider {
250256
});
251257
}
252258

259+
// --------> svelte2tsx?
253260
private isInSvelte2TsxPropLine(fragment: SvelteSnapshotFragment, loc: ts.RenameLocation) {
254261
const pos = positionAt(loc.textSpan.start, fragment.text);
255262
const textInLine = fragment.text.substring(

0 commit comments

Comments
 (0)