mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 09:08:48 +01:00
Don't request ts/js quickfixes for possibly stale diagnostic locations
Fixes #45785
This commit is contained in:
@@ -267,6 +267,11 @@ export default class BufferSyncSupport {
|
||||
}, delay);
|
||||
}
|
||||
|
||||
public hasPendingDiagnostics(resource: Uri): boolean {
|
||||
const file = this.client.normalizePath(resource);
|
||||
return !file || this.pendingDiagnostics.has(file);
|
||||
}
|
||||
|
||||
private sendPendingDiagnostics(): void {
|
||||
if (!this._validate) {
|
||||
return;
|
||||
|
||||
@@ -12,6 +12,7 @@ import FormattingConfigurationManager from './formattingConfigurationManager';
|
||||
import { getEditForCodeAction, applyCodeActionCommands } from '../utils/codeAction';
|
||||
import { Command, CommandManager } from '../utils/commandManager';
|
||||
import { DiagnosticsManager } from './diagnostics';
|
||||
import BufferSyncSupport from './bufferSyncSupport';
|
||||
|
||||
import * as nls from 'vscode-nls';
|
||||
const localize = nls.loadMessageBundle();
|
||||
@@ -132,7 +133,9 @@ export default class TypeScriptQuickFixProvider implements vscode.CodeActionProv
|
||||
private readonly client: ITypeScriptServiceClient,
|
||||
private readonly formattingConfigurationManager: FormattingConfigurationManager,
|
||||
commandManager: CommandManager,
|
||||
private readonly diagnosticsManager: DiagnosticsManager
|
||||
private readonly diagnosticsManager: DiagnosticsManager,
|
||||
private readonly bufferSyncSupport: BufferSyncSupport
|
||||
|
||||
) {
|
||||
commandManager.register(new ApplyCodeActionCommand(client));
|
||||
commandManager.register(new ApplyFixAllCodeAction(client));
|
||||
@@ -160,6 +163,10 @@ export default class TypeScriptQuickFixProvider implements vscode.CodeActionProv
|
||||
return [];
|
||||
}
|
||||
|
||||
if (this.bufferSyncSupport.hasPendingDiagnostics(document.uri)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
await this.formattingConfigurationManager.ensureFormatOptionsForDocument(document, token);
|
||||
|
||||
const results: vscode.CodeAction[] = [];
|
||||
|
||||
@@ -116,7 +116,7 @@ export default class LanguageProvider {
|
||||
this.disposables.push(languages.registerDocumentSymbolProvider(selector, new (await import('./features/documentSymbolProvider')).default(client)));
|
||||
this.disposables.push(languages.registerSignatureHelpProvider(selector, new (await import('./features/signatureHelpProvider')).default(client), '(', ','));
|
||||
this.disposables.push(languages.registerRenameProvider(selector, new (await import('./features/renameProvider')).default(client)));
|
||||
this.disposables.push(languages.registerCodeActionsProvider(selector, new (await import('./features/quickFixProvider')).default(client, this.formattingOptionsManager, commandManager, this.diagnosticsManager)));
|
||||
this.disposables.push(languages.registerCodeActionsProvider(selector, new (await import('./features/quickFixProvider')).default(client, this.formattingOptionsManager, commandManager, this.diagnosticsManager, this.bufferSyncSupport)));
|
||||
this.disposables.push(languages.registerCodeActionsProvider(selector, new (await import('./features/refactorProvider')).default(client, this.formattingOptionsManager, commandManager)));
|
||||
|
||||
await this.initFoldingProvider();
|
||||
|
||||
Reference in New Issue
Block a user