mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-21 09:08:53 +01:00
Extract scheduleDiagnosticsUpdate
This commit is contained in:
@@ -107,10 +107,7 @@ export class DiagnosticsManager {
|
||||
|
||||
collection.set(file, diagnostics);
|
||||
|
||||
const key = file.fsPath;
|
||||
if (!this._pendingUpdates[key]) {
|
||||
this._pendingUpdates[key] = setTimeout(() => this.updateCurrentDiagnostics(file), this.updateDelay);
|
||||
}
|
||||
this.scheduleDiagnosticsUpdate(file);
|
||||
}
|
||||
|
||||
public configFileDiagnosticsReceived(file: vscode.Uri, diagnostics: vscode.Diagnostic[]): void {
|
||||
@@ -121,6 +118,17 @@ export class DiagnosticsManager {
|
||||
this._currentDiagnostics.delete(resource);
|
||||
}
|
||||
|
||||
public getDiagnostics(file: vscode.Uri): vscode.Diagnostic[] {
|
||||
return this._currentDiagnostics.get(file) || [];
|
||||
}
|
||||
|
||||
private scheduleDiagnosticsUpdate(file: vscode.Uri) {
|
||||
const key = file.fsPath;
|
||||
if (!this._pendingUpdates[key]) {
|
||||
this._pendingUpdates[key] = setTimeout(() => this.updateCurrentDiagnostics(file), this.updateDelay);
|
||||
}
|
||||
}
|
||||
|
||||
private updateCurrentDiagnostics(file: vscode.Uri) {
|
||||
if (this._pendingUpdates[file.fsPath]) {
|
||||
clearTimeout(this._pendingUpdates[file.fsPath]);
|
||||
@@ -146,8 +154,4 @@ export class DiagnosticsManager {
|
||||
|
||||
return this._diagnostics.get(DiagnosticKind.Suggestion)!.get(file);
|
||||
}
|
||||
|
||||
public getDiagnostics(file: vscode.Uri): vscode.Diagnostic[] {
|
||||
return this._currentDiagnostics.get(file) || [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user