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

Ability to clear/delete a variable inside EnvironmentVariableCollection when extension is disposed/restarted #234384

Open
alii opened this issue Nov 21, 2024 · 0 comments
Assignees

Comments

@alii
Copy link

alii commented Nov 21, 2024

Currently when an extension is disposed, vscode (as far as I can tell) will ignore usage of EnvironmentVariableCollection.clear() or EnvironmentVariableCollection.delete(key)

context.subscriptions.push({
    dispose() {
      // Tried both clear and replace at the same time, as well as independently. Seemingly no results with any combination
      context.environmentVariableCollection.replace("MY_UNIX_SOCKET", "");
      context.environmentVariableCollection.clear();
    },
});

This is frustrating in our use case, because we have a unix socket that is created each time the extension starts - which means that if the user restarts the extension host we generate a new socket url. Existing terminals then can no longer communicate with the socket, and have to relaunch their terminal. Currently as a workaround I'm storing the socket url in context.globalState and reusing it on restart. This works and existing terminals can just keep assuming the stale URL is correct, but ideally we'd be able to create a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants