diff --git a/src/vs/editor/contrib/referenceSearch/browser/referencesController.ts b/src/vs/editor/contrib/referenceSearch/browser/referencesController.ts index 844513d32e5..23c5d62212b 100644 --- a/src/vs/editor/contrib/referenceSearch/browser/referencesController.ts +++ b/src/vs/editor/contrib/referenceSearch/browser/referencesController.ts @@ -119,7 +119,7 @@ export class ReferencesController implements editorCommon.IEditorContribution { && getConfigurationValue(this._configurationService.getConfiguration(), 'editor.stablePeek', false)) { // when stable peek is configured we don't close - // the peek window on selecting the editor + // the peek window on selecting the editor break; } case 'side': @@ -163,13 +163,15 @@ export class ReferencesController implements editorCommon.IEditorContribution { return this._widget.setModel(this._model).then(() => { // set title - this._widget.setMetaTitle(options.getMetaTitle(model)); + this._widget.setMetaTitle(options.getMetaTitle(this._model)); // set 'best' selection let uri = this._editor.getModel().uri; let pos = { lineNumber: range.startLineNumber, column: range.startColumn }; let selection = this._model.nearestReference(uri, pos); - return this._widget.setSelection(selection); + if (selection) { + return this._widget.setSelection(selection); + } }); }, error => { diff --git a/src/vs/editor/contrib/referenceSearch/browser/referencesWidget.ts b/src/vs/editor/contrib/referenceSearch/browser/referencesWidget.ts index f107ac84a32..4961a9dc43a 100644 --- a/src/vs/editor/contrib/referenceSearch/browser/referencesWidget.ts +++ b/src/vs/editor/contrib/referenceSearch/browser/referencesWidget.ts @@ -621,7 +621,7 @@ export class ReferenceWidget extends PeekViewWidget { if (this._model.empty) { this.setTitle(''); this._messageContainer.innerHtml(nls.localize('noResults', "No results")).show(); - return; + return TPromise.as(void 0); } this._messageContainer.hide();