-
Notifications
You must be signed in to change notification settings - Fork 27.9k
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
Improve output channel API options #59322
Comments
@joaomoreno welcome to the party: #58116 (comment) |
@sandy081 I actually don't know why we have options instead of a simple boolean? |
|
Since it's not very intuitive we try to avoid something optional that defaults to true |
@jrieken I think you had the same question during review and it is because There is a request to set a lang id for channels. If so it has to be set while creating. Hence created options object. |
I also think |
and that means it is not in memory? |
Eventually, for all channels, content gets loaded in to model which is in memory to show in the UI. But the difference is that those channels with special flag, directly transmit data to renderer from ext host, in which case data remains in memory. |
Well, you decide, these are the constraints
Last, be aware that you created this problem just for yourself (trying to avoid a third argument in the future) and that using a parameter gives you the flexibility to change it later |
/**
* Options to configure the behavior of the [OutputChannel](#OutputChannel)
*/
export interface OutputChannelOptions {
/**
* By default, data appended to Output channels is written into a log file and is not piped to UI process immediately.
* Output channel UI is updated by listening to the corresponding log file changes.
* This helps to reduce CPU load on the UI process but also means that the output channel UI updates with a small delay.
*
* Enabling this flag will allow the data to be piped to UI process for immediate updates at the cost of higher CPU usage.
*/
readonly enablePiping?: boolean
}
/**
* Creates a new [output channel](#OutputChannel) with the given name.
*
* @param name Human-readable string which will be used to represent the channel in the UI.
* @param options Options to configure the behavior of the channel.
*/
export function createOutputChannel(name: string, options?: OutputChannelOptions): OutputChannel;
What do you think? |
I think you should make it a param instead of an object and pick any name because that's not set in stone |
Removed the options completely. |
Testing #59238
There's a couple issues with the current API:
options
should be extracted to an independent type:OutputChannelOptions
.Output channels use a separate transport mechanism when appending data
... separate from what? Let's go straight to the point and just mention the different options for creating output channels and their implications.force
field of theoptions
bag, not thecreateOutputChannel
function.force
is a terrible name. @jrieken can surely come up with a better abstraction, he usually doestype
instead? That way it'll make it easier to describe that there are two different types of output channels, each with its own perf/qos characteristics, and the caller can override from the default type, etc.The text was updated successfully, but these errors were encountered: