Skip to content

Commit

Permalink
Fix not removing associated data for type variant
Browse files Browse the repository at this point in the history
  • Loading branch information
Qluxzz authored and razzeee committed Feb 6, 2024
1 parent b52d88e commit 2d59d0d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/common/util/refactorEditUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,14 +476,16 @@ export class RefactorEditUtils {
return this.removeType(unionVariants[0].parent);
}

let startPosition = nodeAtPosition.startPosition;
let endPosition = nodeAtPosition.endPosition;

const unionVariant = unionVariants?.find(
(a) =>
a.text.startsWith(`${nodeAtPosition.text} `) ||
a.text === nodeAtPosition.text,
);

let startPosition =
unionVariant?.startPosition ?? nodeAtPosition.startPosition;
let endPosition = unionVariant?.endPosition ?? nodeAtPosition.endPosition;

if (unionVariant?.previousSibling?.type == "eq") {
startPosition = unionVariant.previousSibling?.endPosition;
if (unionVariant.nextSibling?.type == "|") {
Expand Down

0 comments on commit 2d59d0d

Please sign in to comment.