Merge from master

This commit is contained in:
Raj Musuku
2019-02-21 17:56:04 -08:00
parent 5a146e34fa
commit 666ae11639
11482 changed files with 119352 additions and 255574 deletions

View File

@@ -3,10 +3,8 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as assert from 'assert';
import URI, { UriComponents } from 'vs/base/common/uri';
import { URI, UriComponents } from 'vs/base/common/uri';
import { DiagnosticCollection, ExtHostDiagnostics } from 'vs/workbench/api/node/extHostDiagnostics';
import { Diagnostic, DiagnosticSeverity, Range, DiagnosticRelatedInformation, Location } from 'vs/workbench/api/node/extHostTypes';
import { MainThreadDiagnosticsShape, IMainContext } from 'vs/workbench/api/node/extHost.protocol';
@@ -25,7 +23,7 @@ suite('ExtHostDiagnostics', () => {
}
}
test('disposeCheck', function () {
test('disposeCheck', () => {
const collection = new DiagnosticCollection('test', 'test', 100, new DiagnosticsShape(), new Emitter());
@@ -190,6 +188,31 @@ suite('ExtHostDiagnostics', () => {
lastEntries = undefined;
});
test('don\'t send message when not making a change', function () {
let changeCount = 0;
let eventCount = 0;
const emitter = new Emitter<any>();
emitter.event(_ => eventCount += 1);
const collection = new DiagnosticCollection('test', 'test', 100, new class extends DiagnosticsShape {
$changeMany() {
changeCount += 1;
}
}, emitter);
let uri = URI.parse('sc:hightower');
let diag = new Diagnostic(new Range(0, 0, 0, 1), 'ffff');
collection.set(uri, [diag]);
assert.equal(changeCount, 1);
assert.equal(eventCount, 1);
collection.set(uri, [diag]);
assert.equal(changeCount, 1);
assert.equal(eventCount, 2);
});
test('diagnostics collection, tuples and undefined (small array), #15585', function () {
const collection = new DiagnosticCollection('test', 'test', 100, new DiagnosticsShape(), new Emitter());
@@ -376,4 +399,29 @@ suite('ExtHostDiagnostics', () => {
assert.equal(ownerHistory[0], 'foo');
assert.equal(ownerHistory[1], 'foo0');
});
test('Error updating diagnostics from extension #60394', function () {
let callCount = 0;
let collection = new DiagnosticCollection('ddd', 'test', 100, new class extends DiagnosticsShape {
$changeMany(owner: string, entries: [UriComponents, IMarkerData[]][]) {
callCount += 1;
}
}, new Emitter<any>());
let array: Diagnostic[] = [];
let diag1 = new Diagnostic(new Range(0, 0, 1, 1), 'Foo');
let diag2 = new Diagnostic(new Range(0, 0, 1, 1), 'Bar');
array.push(diag1, diag2);
collection.set(URI.parse('test:me'), array);
assert.equal(callCount, 1);
collection.set(URI.parse('test:me'), array);
assert.equal(callCount, 1); // equal array
array.push(diag2);
collection.set(URI.parse('test:me'), array);
assert.equal(callCount, 2); // same but un-equal array
});
});