Skip to content

Commit

Permalink
output: nicer syntax for getting channels from registry
Browse files Browse the repository at this point in the history
  • Loading branch information
isidorn committed Apr 14, 2016
1 parent dd9380a commit f0ce8d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/vs/workbench/parts/output/browser/outputActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export class SwitchOutputActionItem extends SelectActionItem {
}

protected getActionContext(option: string): string {
const channel = (<IOutputChannelRegistry>Registry.as(Extensions.OutputChannels)).getChannels().filter(channelData => channelData.label === option).pop();
const channel = Registry.as<IOutputChannelRegistry>(Extensions.OutputChannels).getChannels().filter(channelData => channelData.label === option).pop();

return channel ? channel.id : option;
}
Expand All @@ -128,7 +128,7 @@ export class SwitchOutputActionItem extends SelectActionItem {
}

private static getChannelLabels(outputService: IOutputService): string[] {
const contributedChannels = (<IOutputChannelRegistry>Registry.as(Extensions.OutputChannels)).getChannels().map(channelData => channelData.label);
const contributedChannels = Registry.as<IOutputChannelRegistry>(Extensions.OutputChannels).getChannels().map(channelData => channelData.label);
return contributedChannels.sort(); // sort by name
}
}
4 changes: 2 additions & 2 deletions src/vs/workbench/parts/output/common/outputServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class OutputService implements IOutputService {

this.receivedOutput = Object.create(null);

const channels = (<IOutputChannelRegistry>Registry.as(Extensions.OutputChannels)).getChannels();
const channels = Registry.as<IOutputChannelRegistry>(Extensions.OutputChannels).getChannels();
this.activeChannelId = this.storageService.get(OUTPUT_ACTIVE_CHANNEL_KEY, StorageScope.WORKSPACE, channels && channels.length > 0 ? channels[0].id : null);
}

Expand All @@ -61,7 +61,7 @@ export class OutputService implements IOutputService {
}

public getChannel(id: string): IOutputChannel {
const channelData = (<IOutputChannelRegistry>Registry.as(Extensions.OutputChannels)).getChannels().filter(channelData => channelData.id === id).pop();
const channelData = Registry.as<IOutputChannelRegistry>(Extensions.OutputChannels).getChannels().filter(channelData => channelData.id === id).pop();
if (!channelData) {
return null;
}
Expand Down

0 comments on commit f0ce8d7

Please sign in to comment.