mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 10:38:59 +01:00
Clean up validation update logic
This commit is contained in:
@@ -32,41 +32,41 @@ export default class DiagnosticsManager {
|
||||
this.semanticDiagnostics = Object.create(null);
|
||||
}
|
||||
|
||||
public updateValidate(value: boolean) {
|
||||
public set validate(value: boolean) {
|
||||
if (this._validate === value) {
|
||||
return;
|
||||
}
|
||||
this._validate = value;
|
||||
if (!value) {
|
||||
this.syntaxDiagnostics = Object.create(null);
|
||||
this.semanticDiagnostics = Object.create(null);
|
||||
this.currentDiagnostics.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public syntaxDiagnosticsReceived(file: string, syntaxDiagnostics: Diagnostic[]): void {
|
||||
if (!this._validate) {
|
||||
return;
|
||||
}
|
||||
this.syntaxDiagnostics[file] = syntaxDiagnostics;
|
||||
const semanticDianostics = this.semanticDiagnostics[file] || [];
|
||||
this.currentDiagnostics.set(this.client.asUrl(file), semanticDianostics.concat(syntaxDiagnostics));
|
||||
this.updateCurrentDiagnostics(file);
|
||||
}
|
||||
|
||||
public semanticDiagnosticsReceived(file: string, semanticDiagnostics: Diagnostic[]): void {
|
||||
if (!this._validate) {
|
||||
return;
|
||||
}
|
||||
this.semanticDiagnostics[file] = semanticDiagnostics;
|
||||
const syntaxDiagnostics = this.syntaxDiagnostics[file] || [];
|
||||
this.currentDiagnostics.set(this.client.asUrl(file), semanticDiagnostics.concat(syntaxDiagnostics));
|
||||
this.updateCurrentDiagnostics(file);
|
||||
}
|
||||
|
||||
public configFileDiagnosticsReceived(file: string, diagnostics: Diagnostic[]): void {
|
||||
this.currentDiagnostics.set(this.client.asUrl(file), diagnostics);
|
||||
}
|
||||
|
||||
public delete(file: string) {
|
||||
public delete(file: string): void {
|
||||
this.currentDiagnostics.delete(this.client.asUrl(file));
|
||||
}
|
||||
|
||||
private updateCurrentDiagnostics(file: string) {
|
||||
if (!this._validate) {
|
||||
return;
|
||||
}
|
||||
|
||||
const semanticDiagnostics = this.semanticDiagnostics[file] || [];
|
||||
const syntaxDiagnostics = this.syntaxDiagnostics[file] || [];
|
||||
this.currentDiagnostics.set(this.client.asUrl(file), semanticDiagnostics.concat(syntaxDiagnostics));
|
||||
}
|
||||
}
|
||||
@@ -362,7 +362,7 @@ class LanguageProvider {
|
||||
}
|
||||
this._validate = value;
|
||||
this.bufferSyncSupport.validate = value;
|
||||
this.diagnosticsManager.updateValidate(value);
|
||||
this.diagnosticsManager.validate = value;
|
||||
if (value) {
|
||||
this.triggerAllDiagnostics();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user