Merge VS Code 1.23.1 (#1520)

This commit is contained in:
Matt Irvine
2018-06-05 11:24:51 -07:00
committed by GitHub
parent e3baf5c443
commit 0c58f09e59
3651 changed files with 74249 additions and 48599 deletions

View File

@@ -7,12 +7,12 @@
import * as assert from 'assert';
import URI, { UriComponents } from 'vs/base/common/uri';
import Severity from 'vs/base/common/severity';
import { DiagnosticCollection } from 'vs/workbench/api/node/extHostDiagnostics';
import { Diagnostic, DiagnosticSeverity, Range } from 'vs/workbench/api/node/extHostTypes';
import { Diagnostic, DiagnosticSeverity, Range, DiagnosticRelatedInformation, Location } from 'vs/workbench/api/node/extHostTypes';
import { MainThreadDiagnosticsShape } from 'vs/workbench/api/node/extHost.protocol';
import { IMarkerData } from 'vs/platform/markers/common/markers';
import { IMarkerData, MarkerSeverity } from 'vs/platform/markers/common/markers';
import { mock } from 'vs/workbench/test/electron-browser/api/mock';
import { Emitter, toPromise } from 'vs/base/common/event';
suite('ExtHostDiagnostics', () => {
@@ -27,7 +27,7 @@ suite('ExtHostDiagnostics', () => {
test('disposeCheck', function () {
const collection = new DiagnosticCollection('test', new DiagnosticsShape());
const collection = new DiagnosticCollection('test', new DiagnosticsShape(), new Emitter());
collection.dispose();
collection.dispose(); // that's OK
@@ -44,13 +44,13 @@ suite('ExtHostDiagnostics', () => {
test('diagnostic collection, forEach, clear, has', function () {
let collection = new DiagnosticCollection('test', new DiagnosticsShape());
let collection = new DiagnosticCollection('test', new DiagnosticsShape(), new Emitter());
assert.equal(collection.name, 'test');
collection.dispose();
assert.throws(() => collection.name);
let c = 0;
collection = new DiagnosticCollection('test', new DiagnosticsShape());
collection = new DiagnosticCollection('test', new DiagnosticsShape(), new Emitter());
collection.forEach(() => c++);
assert.equal(c, 0);
@@ -87,7 +87,7 @@ suite('ExtHostDiagnostics', () => {
});
test('diagnostic collection, immutable read', function () {
let collection = new DiagnosticCollection('test', new DiagnosticsShape());
let collection = new DiagnosticCollection('test', new DiagnosticsShape(), new Emitter());
collection.set(URI.parse('foo:bar'), [
new Diagnostic(new Range(0, 0, 1, 1), 'message-1'),
new Diagnostic(new Range(0, 0, 1, 1), 'message-2')
@@ -112,7 +112,7 @@ suite('ExtHostDiagnostics', () => {
test('diagnostics collection, set with dupliclated tuples', function () {
let collection = new DiagnosticCollection('test', new DiagnosticsShape());
let collection = new DiagnosticCollection('test', new DiagnosticsShape(), new Emitter());
let uri = URI.parse('sc:hightower');
collection.set([
[uri, [new Diagnostic(new Range(0, 0, 0, 1), 'message-1')]],
@@ -168,7 +168,7 @@ suite('ExtHostDiagnostics', () => {
lastEntries = entries;
return super.$changeMany(owner, entries);
}
});
}, new Emitter());
let uri = URI.parse('sc:hightower');
collection.set([[uri, [new Diagnostic(new Range(0, 0, 1, 1), 'error')]]]);
@@ -192,7 +192,7 @@ suite('ExtHostDiagnostics', () => {
test('diagnostics collection, tuples and undefined (small array), #15585', function () {
const collection = new DiagnosticCollection('test', new DiagnosticsShape());
const collection = new DiagnosticCollection('test', new DiagnosticsShape(), new Emitter());
let uri = URI.parse('sc:hightower');
let uri2 = URI.parse('sc:nomad');
let diag = new Diagnostic(new Range(0, 0, 0, 1), 'ffff');
@@ -213,7 +213,7 @@ suite('ExtHostDiagnostics', () => {
test('diagnostics collection, tuples and undefined (large array), #15585', function () {
const collection = new DiagnosticCollection('test', new DiagnosticsShape());
const collection = new DiagnosticCollection('test', new DiagnosticsShape(), new Emitter());
const tuples: [URI, Diagnostic[]][] = [];
for (let i = 0; i < 500; i++) {
@@ -242,7 +242,7 @@ suite('ExtHostDiagnostics', () => {
lastEntries = entries;
return super.$changeMany(owner, entries);
}
});
}, new Emitter());
let uri = URI.parse('aa:bb');
let diagnostics: Diagnostic[] = [];
@@ -256,8 +256,72 @@ suite('ExtHostDiagnostics', () => {
assert.equal(collection.get(uri).length, 500);
assert.equal(lastEntries.length, 1);
assert.equal(lastEntries[0][1].length, 251);
assert.equal(lastEntries[0][1][0].severity, Severity.Error);
assert.equal(lastEntries[0][1][200].severity, Severity.Warning);
assert.equal(lastEntries[0][1][250].severity, Severity.Error);
assert.equal(lastEntries[0][1][0].severity, MarkerSeverity.Error);
assert.equal(lastEntries[0][1][200].severity, MarkerSeverity.Warning);
assert.equal(lastEntries[0][1][250].severity, MarkerSeverity.Error);
});
test('diagnostic eventing', 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');
let diag2 = new Diagnostic(new Range(1, 1, 2, 3), 'diag2');
let diag3 = new Diagnostic(new Range(1, 1, 2, 3), 'diag3');
let p = toPromise(emitter.event).then(a => {
assert.equal(a.length, 1);
assert.equal(a[0].toString(), 'aa:bb');
assert.ok(URI.isUri(a[0]));
});
collection.set(URI.parse('aa:bb'), []);
await p;
p = toPromise(emitter.event).then(e => {
assert.equal(e.length, 2);
assert.ok(URI.isUri(e[0]));
assert.ok(URI.isUri(e[1]));
assert.equal(e[0].toString(), 'aa:bb');
assert.equal(e[1].toString(), 'aa:cc');
});
collection.set([
[URI.parse('aa:bb'), [diag1]],
[URI.parse('aa:cc'), [diag2, diag3]],
]);
await p;
p = toPromise(emitter.event).then(e => {
assert.equal(e.length, 2);
assert.ok(typeof e[0] === 'string');
assert.ok(typeof e[1] === 'string');
});
collection.clear();
await p;
});
test('diagnostics with related information', function (done) {
let collection = new DiagnosticCollection('ddd', new class extends DiagnosticsShape {
$changeMany(owner: string, entries: [UriComponents, IMarkerData[]][]) {
let [[, data]] = entries;
assert.equal(entries.length, 1);
assert.equal(data.length, 1);
let [diag] = data;
assert.equal(diag.relatedInformation.length, 2);
assert.equal(diag.relatedInformation[0].message, 'more1');
assert.equal(diag.relatedInformation[1].message, 'more2');
done();
}
}, new Emitter<any>());
let diag = new Diagnostic(new Range(0, 0, 1, 1), 'Foo');
diag.relatedInformation = [
new DiagnosticRelatedInformation(new Location(URI.parse('cc:dd'), new Range(0, 0, 0, 0)), 'more1'),
new DiagnosticRelatedInformation(new Location(URI.parse('cc:ee'), new Range(0, 0, 0, 0)), 'more2')
];
collection.set(URI.parse('aa:bb'), [diag]);
});
});