From a4e3aada07743a39c2e54b50923ccfa0008fdb1b Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Wed, 3 Aug 2016 09:57:20 +0200 Subject: [PATCH] allow a Location to be created without a range or position --- src/vs/workbench/api/node/extHostTypes.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/api/node/extHostTypes.ts b/src/vs/workbench/api/node/extHostTypes.ts index 8a4b6d20598..14c3140f320 100644 --- a/src/vs/workbench/api/node/extHostTypes.ts +++ b/src/vs/workbench/api/node/extHostTypes.ts @@ -509,13 +509,15 @@ export class Location { uri: URI; range: Range; - constructor(uri: URI, range: Range | Position) { + constructor(uri: URI, rangeOrPosition: Range | Position) { this.uri = uri; - if (range instanceof Range) { - this.range = range; - } else if (range instanceof Position) { - this.range = new Range(range, range); + if (!rangeOrPosition) { + //that's OK + } else if (rangeOrPosition instanceof Range) { + this.range = rangeOrPosition; + } else if (rangeOrPosition instanceof Position) { + this.range = new Range(rangeOrPosition, rangeOrPosition); } else { throw new Error('Illegal argument'); } -- GitLab