merge tuples of equal Uri, #6373

This commit is contained in:
Johannes Rieken
2016-05-17 11:22:28 +02:00
parent bc3837edef
commit 4458bdf5c0
2 changed files with 61 additions and 1 deletions

View File

@@ -72,8 +72,19 @@ export class DiagnosticCollection implements vscode.DiagnosticCollection {
toSync = [];
for (let entry of first) {
let [uri, diagnostics] = entry;
this._data[uri.toString()] = diagnostics;
toSync.push(uri);
if (!diagnostics) {
// [Uri, undefined] means clear this
delete this._data[uri.toString()];
} else {
// set or merge diagnostics
let existing = this._data[uri.toString()];
if (existing) {
existing.push(...diagnostics);
} else {
this._data[uri.toString()] = diagnostics;
}
}
}
}