From b2a424bf310f24c289baaefcd115ee72dddfb48b Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Wed, 3 Aug 2016 09:24:32 +0200 Subject: [PATCH] deprecate old ctor but keep it working --- src/vs/vscode.d.ts | 2 ++ src/vs/workbench/api/node/extHostTypes.ts | 4 ++-- src/vs/workbench/test/node/api/extHostTypes.test.ts | 7 +++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index 6b6c9479ecf..a4686e55d87 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -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. diff --git a/src/vs/workbench/api/node/extHostTypes.ts b/src/vs/workbench/api/node/extHostTypes.ts index 2089e4cc862..8a4b6d20598 100644 --- a/src/vs/workbench/api/node/extHostTypes.ts +++ b/src/vs/workbench/api/node/extHostTypes.ts @@ -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( locationOrUri, rangeOrContainer); } } diff --git a/src/vs/workbench/test/node/api/extHostTypes.test.ts b/src/vs/workbench/test/node/api/extHostTypes.test.ts index 652f5ef1fb4..1c4e8856f0c 100644 --- a/src/vs/workbench/test/node/api/extHostTypes.test.ts +++ b/src/vs/workbench/test/node/api/extHostTypes.test.ts @@ -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); + }); }); \ No newline at end of file -- GitLab