提交 cc83c18d 编写于 作者: J Johannes Rieken

fix #49582

上级 8835c06e
......@@ -147,6 +147,7 @@ export class DiagnosticCollection implements vscode.DiagnosticCollection {
delete(uri: vscode.Uri): void {
this._checkDisposed();
this._onDidChangeDiagnostics.fire([uri]);
this._data.delete(uri.toString());
this._proxy.$changeMany(this.name, [[uri, undefined]]);
}
......
......@@ -299,6 +299,29 @@ suite('ExtHostDiagnostics', () => {
await p;
});
test('vscode.languages.onDidChangeDiagnostics Does Not Provide Document URI #49582', async function () {
let emitter = new Emitter<(string | URI)[]>();
let collection = new DiagnosticCollection('ddd', new DiagnosticsShape(), emitter);
let diag1 = new Diagnostic(new Range(1, 1, 2, 3), 'diag1');
// delete
collection.set(URI.parse('aa:bb'), [diag1]);
let p = toPromise(emitter.event).then(e => {
assert.equal(e[0].toString(), 'aa:bb');
});
collection.delete(URI.parse('aa:bb'));
await p;
// set->undefined (as delete)
collection.set(URI.parse('aa:bb'), [diag1]);
p = toPromise(emitter.event).then(e => {
assert.equal(e[0].toString(), 'aa:bb');
});
collection.set(URI.parse('aa:bb'), undefined);
await p;
});
test('diagnostics with related information', function (done) {
let collection = new DiagnosticCollection('ddd', new class extends DiagnosticsShape {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册