Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dummdidumm committed Aug 28, 2024
1 parent e0d60f1 commit 8b8d89f
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,16 @@ export class RenameProviderImpl implements RenameProvider {
const mappedLocations = await Promise.all(
renameLocations.map(async (loc) => {
const snapshot = await snapshots.retrieve(loc.fileName);
const text = snapshot.getFullText();
const end = loc.textSpan.start + loc.textSpan.length;

if (!isTextSpanInGeneratedCode(snapshot.getFullText(), loc.textSpan)) {
if (
!(snapshot instanceof SvelteDocumentSnapshot) ||
(!isTextSpanInGeneratedCode(text, loc.textSpan) &&
// prevent generated code for bindings from being renamed
// (it's not inside a generate comment because diagnostics should show up)
text.slice(end + 3, end + 27) !== '__sveltets_binding_value')
) {
return {
...loc,
range: this.mapRangeToOriginal(snapshot, loc.textSpan),
Expand Down

0 comments on commit 8b8d89f

Please sign in to comment.