deprecate old ctor but keep it working

This commit is contained in:
Johannes Rieken 2016-08-03 09:24:32 +02:00
parent de5800af31
commit b2a424bf31
3 changed files with 11 additions and 2 deletions

2
src/vs/vscode.d.ts vendored
View file

@ -1748,6 +1748,8 @@ declare namespace vscode {
constructor(name: string, kind: SymbolKind, containerName: string, location: Location);
/**
* @deprecated Please use the constructor taking a [location](#Location) object.
*
* Creates a new symbol information object.
*
* @param name The name of the symbol.

View file

@ -641,8 +641,8 @@ export class SymbolInformation {
if (locationOrUri instanceof Location) {
this.location = locationOrUri;
} else if(locationOrUri instanceof URI && rangeOrContainer instanceof Range) {
this.location = new Location(locationOrUri, rangeOrContainer);
} else if (rangeOrContainer instanceof Range) {
this.location = new Location(<URI> locationOrUri, rangeOrContainer);
}
}

View file

@ -409,4 +409,11 @@ suite('ExtHostTypes', function () {
assertToJSON(item, { label: 'complete', kind: 'Interface' });
});
test('SymbolInformation, old ctor', function () {
let info = new types.SymbolInformation('foo', types.SymbolKind.Array, new types.Range(1, 1, 2, 3));
assert.ok(info.location instanceof types.Location);
assert.equal(info.location.uri, undefined);
});
});