diff --git a/Extension/src/LanguageServer/references.ts b/Extension/src/LanguageServer/references.ts index b43655692c..77c9c56666 100644 --- a/Extension/src/LanguageServer/references.ts +++ b/Extension/src/LanguageServer/references.ts @@ -9,6 +9,7 @@ import { FindAllRefsView } from './referencesView'; import * as telemetry from '../telemetry'; import * as nls from 'vscode-nls'; import { RenameView } from './renameView'; +import * as logger from '../logger'; nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })(); const localize: nls.LocalizeFunc = nls.loadMessageBundle(); @@ -162,8 +163,6 @@ export class ReferencesManager { initializeViews(): void { if (!this.viewsInitialized) { - this.referencesChannel = vscode.window.createOutputChannel(localize("c.cpp.references", "C/C++ References")); - this.disposables.push(this.referencesChannel); this.findAllRefsView = new FindAllRefsView(); this.renameView = new RenameView(); this.viewsInitialized = true; @@ -340,12 +339,24 @@ export class ReferencesManager { this.referencesViewFindPending = false; this.clearViews(); + if (this.client.ReferencesCommandMode === ReferencesCommandMode.Peek && !this.referencesChannel) { + this.referencesChannel = vscode.window.createOutputChannel(localize("c.cpp.peek.references", "C/C++ Peek References")); + this.disposables.push(this.referencesChannel); + } + if (this.referencesStartedWhileTagParsing) { let msg: string = localize("some.references.may.be.missing", "[Warning] Some references may be missing, because workspace parsing was incomplete when {0} was started.", referencesCommandModeToString(this.client.ReferencesCommandMode)); - this.referencesChannel.appendLine(msg); - this.referencesChannel.appendLine(""); - this.referencesChannel.show(true); + if (this.client.ReferencesCommandMode === ReferencesCommandMode.Peek) { + this.referencesChannel.appendLine(msg); + this.referencesChannel.appendLine(""); + this.referencesChannel.show(true); + } else if (this.client.ReferencesCommandMode === ReferencesCommandMode.Find) { + let logChannel: vscode.OutputChannel = logger.getOutputChannel(); + logChannel.appendLine(msg); + logChannel.appendLine(""); + logChannel.show(true); + } } let currentReferenceCommandMode: ReferencesCommandMode = this.client.ReferencesCommandMode; @@ -411,7 +422,9 @@ export class ReferencesManager { } public clearViews(): void { - this.referencesChannel.clear(); + if (this.referencesChannel) { + this.referencesChannel.clear(); + } this.findAllRefsView.show(false); this.renameView.show(false); }