Skip to content

Commit 134b70c

Browse files
committed
Possibly fix race with tracking disposable code actions
Fixes microsoft#255624
1 parent c66c3f8 commit 134b70c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/vs/editor/contrib/codeAction/browser/codeAction.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,15 @@ export async function getCodeActions(
126126
const handle = setTimeout(() => progress.report(provider), 1250);
127127
try {
128128
const providedCodeActions = await provider.provideCodeActions(model, rangeOrSelection, codeActionContext, cts.token);
129+
if (cts.token.isCancellationRequested) {
130+
providedCodeActions?.dispose();
131+
return emptyCodeActionsResponse;
132+
}
129133

130134
if (providedCodeActions) {
131135
disposables.add(providedCodeActions);
132136
}
133137

134-
if (cts.token.isCancellationRequested) {
135-
return emptyCodeActionsResponse;
136-
}
137-
138138
const filteredActions = (providedCodeActions?.actions || []).filter(action => action && filtersAction(filter, action));
139139
const documentation = getDocumentationFromProvider(provider, filteredActions, filter.include);
140140
return {

0 commit comments

Comments
 (0)