Skip to content

Commit

Permalink
[vscode] Support EnvironmentVariableCollection description #12696
Browse files Browse the repository at this point in the history
* add new field to EnvironmentVariableCollection and implement interface

Contributed on behalf of STMicroelectronics

Signed-off-by: Johannes Faltermeier <jfaltermeier@eclipsesource.com>
  • Loading branch information
jfaltermeier committed Aug 16, 2023
1 parent 04c8cf0 commit f45ef07
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/plugin-ext/src/plugin/terminal-ext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
// *****************************************************************************
import { UUID } from '@theia/core/shared/@phosphor/coreutils';
import { Terminal, TerminalOptions, PseudoTerminalOptions, ExtensionTerminalOptions, TerminalState } from '@theia/plugin';
import { Terminal, TerminalOptions, PseudoTerminalOptions, ExtensionTerminalOptions, TerminalState, MarkdownString } from '@theia/plugin';
import { TerminalServiceExt, TerminalServiceMain, PLUGIN_RPC_CONTEXT } from '../common/plugin-api-rpc';
import { RPCProtocol } from '../common/rpc-protocol';
import { Event, Emitter } from '@theia/core/lib/common/event';
Expand Down Expand Up @@ -339,8 +339,15 @@ export class TerminalServiceExtImpl implements TerminalServiceExt {

export class EnvironmentVariableCollection implements theia.EnvironmentVariableCollection {
readonly map: Map<string, theia.EnvironmentVariableMutator> = new Map();
private _description?: string | MarkdownString;
private _persistent: boolean = true;

public get description(): string | MarkdownString | undefined { return this._description; }
public set description(value: string | MarkdownString | undefined) {
this._description = value;
this.onDidChangeCollectionEmitter.fire();
}

public get persistent(): boolean { return this._persistent; }
public set persistent(value: boolean) {
this._persistent = value;
Expand Down
6 changes: 6 additions & 0 deletions packages/plugin/src/theia.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3585,6 +3585,12 @@ export module '@theia/plugin' {
* A collection of mutations that an extension can apply to a process environment.
*/
export interface EnvironmentVariableCollection {

/**
* A description for the environment variable collection, this will be used to describe the changes in the UI.
*/
description: string | MarkdownString | undefined;

/**
* Whether the collection should be cached for the workspace and applied to the terminal
* across window reloads. When true the collection will be active immediately such when the
Expand Down

0 comments on commit f45ef07

Please sign in to comment.