Skip to content

Commit

Permalink
Change "C/C++ References" output panel to "C/C++ Peek References" and…
Browse files Browse the repository at this point in the history
… create it when Peek occurs (#4363)

* change output panel and create it when Peek occurs
* create output pane only on peek references
  • Loading branch information
Jasdriel authored and sean-mcmanus committed Oct 1, 2019
1 parent 346ee37 commit 66b12b8
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions Extension/src/LanguageServer/references.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 66b12b8

Please sign in to comment.