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 environmentVariableCollection to PluginContext #8523

Merged
merged 1 commit into from
Oct 12, 2020
Merged

Conversation

vinokurig
Copy link
Contributor

What it does

Add environmentVariableCollection to PluginContext to align it with ExtensionContext from vscode.

related CQ: https://dev.eclipse.org/ipzilla/show_bug.cgi?id=22598
fixes #8405

How to test

  1. Clone the test plugin and compile it, or download the vsix file
  2. Start the plugin and run F1 => Environment variable: Open terminal. This command opens a new terminal with predefined environment variables and changes them with the help of the environmentVariableCollection plugin API:
        collection = context.environmentVariableCollection;
        collection.replace('A', '~a2~');
        collection.append('B', '~b2~');
        collection.prepend('C', '~c2~');

        const terminal = theia.window.createTerminal({
            env: {
                A: 'a1',
                B: 'b1',
                C: 'c1'
            }
        });
        terminal.show();
        terminal.sendText('echo $A');
        terminal.sendText('echo $B');
        terminal.sendText('echo $C');

See :

echo $A
echo $B
echo $C
[ivinokur@localhost environment-variable]$ echo $A
~a2~
[ivinokur@localhost environment-variable]$ echo $B
b1~b2~
[ivinokur@localhost environment-variable]$ echo $C
~c2~c1
[ivinokur@localhost environment-variable]$ 
  1. The environment variable collection is stored by default, to test it stop the plugin and then start it again, open a new terminal and type echo $A $B $C, see:
~a2~ ~b2~ ~c2~
  1. Run F1 => Environment variable: Clear collection, open a new terminal and type echo $A $B $C: see an empty line.

Review checklist

Reminder for reviewers

@vinokurig vinokurig added terminal issues related to the terminal plug-in system issues related to the plug-in system vscode issues related to VSCode compatibility CQ Required (deprecated) issues requiring a CQ (contributor questionnaire) labels Sep 18, 2020
Copy link
Member

@azatsarynnyy azatsarynnyy left a comment

Choose a reason for hiding this comment

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

Works well. Thank you for providing the test plugin!

Signed-off-by: Igor Vinokur <ivinokur@redhat.com>
@vinokurig
Copy link
Contributor Author

@akosyakov @westbury Could you please take a look?

Copy link
Contributor

@benoitf benoitf left a comment

Choose a reason for hiding this comment

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

Tested with prebuilt vsix

set of env variables and clear of env variables are propagated

I've also reworked sample to make it vs code compliant and try it on VS Code and I have the same result (set and clear commands)

Screenshot 2020-10-12 at 11 25 05
theia

@benoitf
Copy link
Contributor

benoitf commented Oct 12, 2020

I propose to merge this PR this afternoon if there is no objection as it's already there since more than 3 weeks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CQ Required (deprecated) issues requiring a CQ (contributor questionnaire) plug-in system issues related to the plug-in system terminal issues related to the terminal vscode issues related to VSCode compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add environmentVariableCollection to PluginContext
3 participants