Skip to content

Commit d444862

Browse files
committed
output: getActiveChannel -> getActiveChannelId, remove unnused getChannels
1 parent c7a3171 commit d444862

5 files changed

Lines changed: 11 additions & 23 deletions

File tree

src/vs/workbench/parts/output/browser/outputActions.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import {TPromise} from 'vs/base/common/winjs.base';
88
import nls = require('vs/nls');
99
import {Registry} from 'vs/platform/platform';
10-
import arrays = require('vs/base/common/arrays');
1110
import {IAction, Action} from 'vs/base/common/actions';
1211
import {EditorAction} from 'vs/editor/common/editorAction';
1312
import {Behaviour} from 'vs/editor/common/editorActionEnablement';
@@ -39,7 +38,7 @@ export class ToggleOutputAction extends Action {
3938
return TPromise.as(null);
4039
}
4140

42-
return this.outputService.getOutputChannel(this.outputService.getActiveChannel()).show();
41+
return this.outputService.getOutputChannel(this.outputService.getActiveChannelId()).show();
4342
}
4443
}
4544

@@ -53,7 +52,7 @@ export class ClearOutputAction extends Action {
5352
}
5453

5554
public run(): TPromise<any> {
56-
this.outputService.getOutputChannel(this.outputService.getActiveChannel()).clear();
55+
this.outputService.getOutputChannel(this.outputService.getActiveChannelId()).clear();
5756
this.panelService.getActivePanel().focus();
5857

5958
return TPromise.as(true);
@@ -84,7 +83,7 @@ export class ClearOutputEditorAction extends EditorAction {
8483
}
8584

8685
public run(): TPromise<boolean> {
87-
this.outputService.getOutputChannel(this.outputService.getActiveChannel()).clear();
86+
this.outputService.getOutputChannel(this.outputService.getActiveChannelId()).clear();
8887
return TPromise.as(false);
8988
}
9089
}
@@ -110,22 +109,20 @@ export class SwitchOutputActionItem extends SelectActionItem {
110109
action: IAction,
111110
@IOutputService private outputService: IOutputService
112111
) {
113-
super(null, action, SwitchOutputActionItem.getChannels(outputService), Math.max(0, SwitchOutputActionItem.getChannels(outputService).indexOf(outputService.getActiveChannel())));
112+
super(null, action, SwitchOutputActionItem.getChannels(outputService), Math.max(0, SwitchOutputActionItem.getChannels(outputService).indexOf(outputService.getActiveChannelId())));
114113
this.toDispose.push(this.outputService.onOutputChannel(this.onOutputChannel, this));
115114
this.toDispose.push(this.outputService.onActiveOutputChannel(this.onOutputChannel, this));
116115
}
117116

118117
private onOutputChannel(): void {
119118
let channels = SwitchOutputActionItem.getChannels(this.outputService);
120-
let selected = Math.max(0, channels.indexOf(this.outputService.getActiveChannel()));
119+
let selected = Math.max(0, channels.indexOf(this.outputService.getActiveChannelId()));
121120

122121
this.setOptions(channels, selected);
123122
}
124123

125124
private static getChannels(outputService: IOutputService): string[] {
126125
const contributedChannels = (<IOutputChannelRegistry>Registry.as(Extensions.OutputChannels)).getChannels().map(channelData => channelData.id);
127-
const usedChannels = outputService.getChannels();
128-
129-
return arrays.distinct(contributedChannels.concat(usedChannels)).sort(); // sort by name
126+
return contributedChannels.sort(); // sort by name
130127
}
131128
}

src/vs/workbench/parts/output/browser/outputPanel.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export class OutputPanel extends StringEditor {
8585
options.rulers = [];
8686
options.folding = false;
8787

88-
let channel = this.outputService.getActiveChannel();
88+
let channel = this.outputService.getActiveChannelId();
8989
options.ariaLabel = channel ? nls.localize('outputPanelWithInputAriaLabel', "{0}, Output panel", channel) : nls.localize('outputPanelAriaLabel', "Output panel");
9090

9191
return options;
@@ -97,7 +97,7 @@ export class OutputPanel extends StringEditor {
9797

9898
public create(parent: Builder): TPromise<void> {
9999
return super.create(parent)
100-
.then(() => this.setInput(OutputEditorInput.getInstance(this.instantiationService, this.outputService.getActiveChannel()), null));
100+
.then(() => this.setInput(OutputEditorInput.getInstance(this.instantiationService, this.outputService.getActiveChannelId()), null));
101101
}
102102

103103
public focus(): void {

src/vs/workbench/parts/output/common/output.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,10 @@ export interface IOutputService {
5656

5757
getOutputChannel(id: string): IOutputChannel;
5858

59-
/**
60-
* Returns all channels that received output in the current session.
61-
*/
62-
getChannels(): string[];
63-
6459
/**
6560
* Returns the name of the currently opened channel.
6661
*/
67-
getActiveChannel(): string;
62+
getActiveChannelId(): string;
6863

6964
/**
7065
* Allows to register on Output events

src/vs/workbench/parts/output/common/outputEditorInput.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export class OutputEditorInput extends StringEditorInput {
9898

9999
private isVisible(): boolean {
100100
const panel = this.panelService.getActivePanel();
101-
return panel && panel.getId() === OUTPUT_PANEL_ID && this.outputService.getActiveChannel() === this.channelId;
101+
return panel && panel.getId() === OUTPUT_PANEL_ID && this.outputService.getActiveChannelId() === this.channelId;
102102
}
103103

104104
private scheduleOutputAppend(): void {

src/vs/workbench/parts/output/common/outputServices.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,7 @@ export class OutputService implements IOutputService {
9393
return this.receivedOutput[channelId] || '';
9494
}
9595

96-
public getChannels(): string[] {
97-
return Object.keys(this.receivedOutput);
98-
}
99-
100-
public getActiveChannel(): string {
96+
public getActiveChannelId(): string {
10197
return this.activeChannelId;
10298
}
10399

0 commit comments

Comments
 (0)