From 66b12b88099a5210567b47d1c508a1335b54415a Mon Sep 17 00:00:00 2001 From: Jorge Reyes Paniagua <51973231+Jasdriel@users.noreply.github.com> Date: Tue, 1 Oct 2019 16:11:30 -0700 Subject: [PATCH] Change "C/C++ References" output panel to "C/C++ Peek References" and create it when Peek occurs (#4363) * change output panel and create it when Peek occurs * create output pane only on peek references --- Extension/src/LanguageServer/references.ts | 25 ++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) 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); }