mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 13:55:41 +01:00
Ignore validation requests for disposed models
This commit is contained in:
parent
ab02fc6402
commit
f3f3e04ad2
1 changed files with 8 additions and 0 deletions
|
|
@ -115,6 +115,10 @@ export class DiagnostcsAdapter extends Adapter {
|
||||||
|
|
||||||
private _doValidate(resource: Uri): void {
|
private _doValidate(resource: Uri): void {
|
||||||
this._worker(resource).then(worker => {
|
this._worker(resource).then(worker => {
|
||||||
|
if (!monaco.editor.getModel(resource)) {
|
||||||
|
// model was disposed in the meantime
|
||||||
|
return null;
|
||||||
|
}
|
||||||
const promises: Promise<ts.Diagnostic[]>[] = [];
|
const promises: Promise<ts.Diagnostic[]>[] = [];
|
||||||
const {noSyntaxValidation, noSemanticValidation} = this._defaults.getDiagnosticsOptions();
|
const {noSyntaxValidation, noSemanticValidation} = this._defaults.getDiagnosticsOptions();
|
||||||
if (!noSyntaxValidation) {
|
if (!noSyntaxValidation) {
|
||||||
|
|
@ -125,6 +129,10 @@ export class DiagnostcsAdapter extends Adapter {
|
||||||
}
|
}
|
||||||
return Promise.join(promises);
|
return Promise.join(promises);
|
||||||
}).then(diagnostics => {
|
}).then(diagnostics => {
|
||||||
|
if (!diagnostics || !monaco.editor.getModel(resource)) {
|
||||||
|
// model was disposed in the meantime
|
||||||
|
return null;
|
||||||
|
}
|
||||||
const markers = diagnostics
|
const markers = diagnostics
|
||||||
.reduce((p, c) => c.concat(p), [])
|
.reduce((p, c) => c.concat(p), [])
|
||||||
.map(d => this._convertDiagnostics(resource, d));
|
.map(d => this._convertDiagnostics(resource, d));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue