Skip to content

Commit baec3fd

Browse files
committed
Use textRangeContainsPositionInclusive
1 parent 5aa2964 commit baec3fd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/services/refactors/inlineVariable.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
SourceFile,
2828
SymbolFlags,
2929
textChanges,
30+
textRangeContainsPositionInclusive,
3031
TypeChecker,
3132
VariableDeclaration,
3233
} from "../_namespaces/ts";
@@ -168,7 +169,7 @@ function getReferenceNodes(declaration: InitializedVariableDeclaration, checker:
168169
}
169170

170171
// Cannot inline recursive declarations (e.g. const foo = () => foo();)
171-
if (findAncestor(ref, node => node === declaration.initializer)) {
172+
if (textRangeContainsPositionInclusive(declaration, ref.pos)) {
172173
return true;
173174
}
174175

0 commit comments

Comments
 (0)