提交 7aa225ac 编写于 作者: M Matt Bierner

Extract scheduleDiagnosticsUpdate

上级 4b6922f1
......@@ -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) || [];
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册