Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add push option in createOutputChannel API #58116

Merged
merged 4 commits into from
Sep 21, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/vs/vscode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6221,11 +6221,16 @@ declare module 'vscode' {
export function createInputBox(): InputBox;

/**
* Create a new [output channel](#OutputChannel) with the given name.
* Creates a new [output channel](#OutputChannel) with the given name.
* By default the UI will not show the appended data immediately.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, we should sell this better... How about: "Output channels use a separate transport mechanism when appending data. This helps to reduce CPU load on the UI process but also means that the output channel UI updates with a small delay. Use the force-flag to enforce immediate updates at the cost of higher CPU usage"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it. You have better marketing skills 👍 😄

* To force UI to show the data immediately pass options with `force` parameter set to `true`.
*
* *NOTE* Default output channels help in improving the performance of VS Code.
*
* @param name Human-readable string which will be used to represent the channel in the UI.
* @param options Optional options to control how the channel will be created.
*/
export function createOutputChannel(name: string): OutputChannel;
export function createOutputChannel(name: string, options?: { force?: boolean }): OutputChannel;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why an object? are there plans for more options?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, there is a request to set a lang id for channels. If so it has to be set while creating


/**
* Create and show a new webview panel.
Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/api/node/extHost.api.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,8 @@ export function createApiFactory(
withProgress<R>(options: vscode.ProgressOptions, task: (progress: vscode.Progress<{ message?: string; worked?: number }>, token: vscode.CancellationToken) => Thenable<R>) {
return extHostProgress.withProgress(extension, options, task);
},
createOutputChannel(name: string, push?: boolean): vscode.OutputChannel {
return extHostOutputService.createOutputChannel(name, push);
createOutputChannel(name: string, options?: { force?: boolean }): vscode.OutputChannel {
return extHostOutputService.createOutputChannel(name, options);
},
createWebviewPanel(viewType: string, title: string, showOptions: vscode.ViewColumn | { viewColumn: vscode.ViewColumn, preserveFocus?: boolean }, options: vscode.WebviewPanelOptions & vscode.WebviewOptions): vscode.WebviewPanel {
return extHostWebviews.createWebview(extension.extensionLocation, viewType, title, showOptions, options);
Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/api/node/extHostOutputService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ export class ExtHostOutputService {
this._proxy = mainContext.getProxy(MainContext.MainThreadOutputService);
}

createOutputChannel(name: string, push: boolean): vscode.OutputChannel {
createOutputChannel(name: string, options?: { force?: boolean }): vscode.OutputChannel {
name = name.trim();
if (!name) {
throw new Error('illegal argument `name`. must not be falsy');
} else {
return push ? new ExtHostPushOutputChannel(name, this._proxy) : new ExtHostPullOutputChannel(name, this._outputDir, this._proxy);
return options && options.force ? new ExtHostPushOutputChannel(name, this._proxy) : new ExtHostPullOutputChannel(name, this._outputDir, this._proxy);
}
}
}