mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 21:06:50 -05:00
Allow cancellation during extract method's symbol walking
This commit is contained in:
@@ -531,7 +531,8 @@ namespace ts.refactor.extractMethod {
|
||||
scopes,
|
||||
enclosingTextRange,
|
||||
sourceFile,
|
||||
context.program.getTypeChecker());
|
||||
context.program.getTypeChecker(),
|
||||
context.cancellationToken);
|
||||
|
||||
context.cancellationToken.throwIfCancellationRequested();
|
||||
|
||||
@@ -932,7 +933,8 @@ namespace ts.refactor.extractMethod {
|
||||
scopes: Scope[],
|
||||
enclosingTextRange: TextRange,
|
||||
sourceFile: SourceFile,
|
||||
checker: TypeChecker) {
|
||||
checker: TypeChecker,
|
||||
cancellationToken: CancellationToken) {
|
||||
|
||||
const allTypeParameterUsages = createMap<TypeParameter>(); // Key is type ID
|
||||
const usagesPerScope: ScopeUsages[] = [];
|
||||
@@ -1045,7 +1047,7 @@ namespace ts.refactor.extractMethod {
|
||||
// PERF: This is potentially very expensive. `type` could be a library type with
|
||||
// a lot of properties, each of which the walker will visit. Unfortunately, the
|
||||
// solution isn't as trivial as filtering to user types because of (e.g.) Array.
|
||||
const symbolWalker = checker.getSymbolWalker();
|
||||
const symbolWalker = checker.getSymbolWalker(() => (cancellationToken.throwIfCancellationRequested(), true));
|
||||
const {visitedTypes} = symbolWalker.walkType(type);
|
||||
|
||||
for (const visitedType of visitedTypes) {
|
||||
|
||||
Reference in New Issue
Block a user