ecksdy / vscode-env-switcher Goto Github PK
View Code? Open in Web Editor NEWThe repo for .ENV Switcher VSCode extension
Home Page: https://marketplace.visualstudio.com/items?itemName=EcksDy.env-switcher
License: MIT License
The repo for .ENV Switcher VSCode extension
Home Page: https://marketplace.visualstudio.com/items?itemName=EcksDy.env-switcher
License: MIT License
Just installed, but can't run any commands or see the switcher button.
Every command I try and run through the Command Palette gives an error like this:
[Window Title]
Visual Studio Code
[Main Instruction]
Command '.ENV Switcher: Select .env file' resulted in an error
[Content]
command 'envSwitcher.selectEnvPreset' not found
[OK]
I am using WSL Ubuntu if that is relevant.
VScode info below:
Version: 1.80.0 (user setup)
Commit: 660393deaaa6d1996740ff4880f1bad43768c814
Date: 2023-07-04T15:06:02.407Z
Electron: 22.3.14
ElectronBuildId: 21893604
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Windows_NT x64 10.0.22621
VSCode Developer tools logs:
workbench.desktop.main.js:sourcemap:627 INFO Invoking resolveAuthority(wsl)...
workbench.desktop.main.js:sourcemap:627 INFO [LocalProcess0][resolveAuthority(wsl,1)][0ms] obtaining proxy...
workbench.desktop.main.js:sourcemap:627 INFO [LocalProcess0][resolveAuthority(wsl,1)][0ms] invoking...
workbench.desktop.main.js:sourcemap:627 INFO [LocalProcess0][resolveAuthority(wsl,1)][1021ms] waiting...
workbench.desktop.main.js:sourcemap:627 INFO [LocalProcess0][resolveAuthority(wsl,1)][2005ms] waiting...
workbench.desktop.main.js:sourcemap:627 INFO [LocalProcess0][resolveAuthority(wsl,1)][3073ms] waiting...
workbench.desktop.main.js:sourcemap:627 INFO [LocalProcess0][resolveAuthority(wsl,1)][3350ms] returned WebSocket(127.0.0.1:61892)
workbench.desktop.main.js:sourcemap:627 INFO resolveAuthority(wsl) returned 'WebSocket(127.0.0.1:61892)' after 3351 ms
workbench.desktop.main.js:sourcemap:627 INFO Creating a socket (renderer-Management-25b46ce3-5340-4f07-81bc-f6ca1d10b8b3)...
workbench.desktop.main.js:sourcemap:627 INFO Creating a socket (renderer-ExtensionHost-5e68752e-a211-4f0f-a471-fc74b1336dd0)...
workbench.desktop.main.js:sourcemap:627 INFO Creating a socket (renderer-Management-25b46ce3-5340-4f07-81bc-f6ca1d10b8b3) was successful after 558 ms.
workbench.desktop.main.js:sourcemap:627 INFO Creating a socket (renderer-ExtensionHost-5e68752e-a211-4f0f-a471-fc74b1336dd0) was successful after 1790 ms.
workbench.desktop.main.js:sourcemap:627 WARN [ms-vscode.remote-server]: The viewsWelcome contribution in 'ms-vscode.remote-server' requires 'enabledApiProposals: ["contribViewsWelcome"]' in order to use the 'group' proposed property.
workbench.desktop.main.js:sourcemap:627 WARN [ms-toolsai.vscode-jupyter-cell-tags]: View container 'jupyter-variables' does not exist and all views registered to it will be added to 'Explorer'.
workbench.desktop.main.js:sourcemap:1842 Overwriting grammar scope name to file mapping for scope source.yaml.
Old grammar file: file:///c%3A/Users/AndyCarter/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/extensions/yaml/syntaxes/yaml.tmLanguage.json.
New grammar file: vscode-remote://wsl%2Bubuntu/home/andycarter/.vscode-server/extensions/redhat.vscode-yaml-1.13.0/syntaxes/yaml.tmLanguage.json
register @ workbench.desktop.main.js:sourcemap:1842
workbench.desktop.main.js:sourcemap:627 WARN No search provider registered for scheme: vscode-remote, waiting
workbench.desktop.main.js:sourcemap:627 INFO [perf] Render performance baseline is 148ms
workbench.desktop.main.js:sourcemap:1962 Activating extension 'EcksDy.env-switcher' failed: Cannot read properties of undefined (reading 'fsPath').
$onExtensionActivationError @ workbench.desktop.main.js:sourcemap:1962
N @ workbench.desktop.main.js:sourcemap:1531
M @ workbench.desktop.main.js:sourcemap:1531
H @ workbench.desktop.main.js:sourcemap:1531
G @ workbench.desktop.main.js:sourcemap:1531
(anonymous) @ workbench.desktop.main.js:sourcemap:1531
w @ workbench.desktop.main.js:sourcemap:69
fire @ workbench.desktop.main.js:sourcemap:69
fire @ workbench.desktop.main.js:sourcemap:598
z @ workbench.desktop.main.js:sourcemap:598
(anonymous) @ workbench.desktop.main.js:sourcemap:598
w @ workbench.desktop.main.js:sourcemap:69
fire @ workbench.desktop.main.js:sourcemap:69
acceptChunk @ workbench.desktop.main.js:sourcemap:598
(anonymous) @ workbench.desktop.main.js:sourcemap:598
(anonymous) @ workbench.desktop.main.js:sourcemap:658
w @ workbench.desktop.main.js:sourcemap:69
fire @ workbench.desktop.main.js:sourcemap:69
i.onload @ workbench.desktop.main.js:sourcemap:658
This is the error I get after running the command:
These are my .env files which I have in the root:
This is my configuration:
"envSwitcher.glob.target": "**/*.env",
"envSwitcher.glob.targetExclude": "**/node_modules/**,**/config/env/**,**/.env.example"
I have some encrypted .env files in the /config/env folder, hence why I'm ignoring that whole folder.
I'm on windows, not using WSL. I've reinstalled the extension and reloaded VSC
Any ideas? Is this an issue on my end or?
i currently have multiple folders in my vscode workspace that have a .env file - icant switch the one i want because it always writes to the other one
I'm currently developing azure functions, and instead of a .env
file, the environment variables are stored in a local.settings.json
file.
Would it be possible to add a preference that would allow us to configure per workspace what the environment file is called? Also, some sort of regex or glob pattern that would allow me to specify that in this workspace, you should look for alternatives that are local.settings.prod.json
or local.settings.testing.json
? This could also be handy for #15
It seems that your plugin isn't compatible with Remote Explorer SSHFS folders.
For completeness sake we should consider setting up a license file. I always reference https://choosealicense.com.
Bonus this will remove one of the warnings on actions. Im not familiar enough with github actions to suggest something for the other warning.
As discussed in #27 (comment)
The app name kind of suggests you are 'switching' between files, which you are :) but if you already have content in a top level .env file then you might not expect this to be overwritten the first time you use it.
I have multiple .env files in my repo, one is in the root of the repo, others in subfolders. I would like env switcher to update .env in the root, but it picks some random in a subfolder. Would it be possible to fix it? BTW, your tool is very useful!
Thanks for the useful tool.
Is it possible to improve it so it could discover available env files not by file extension but also by a a file prefix. For example all the following would be candidates for env switcher:
.env.local
.env.dev
.local.env
.dev.env
Following the discussion on the implementation of supporting multiroot workspaces, I have understood that the current UI solution (button + quick pick) will not suffice to handle multiroot/monorepo workspaces (referred to as m.workspaces from now on).
This realization led me to explore what other options VSCode provides for extensions. I have come up with a sidebar panel that displays a file tree-like structure, showing which presets are selected for which sub-roots.
๐ a-root/
โโโ โ๏ธ **local.env**
๐ b-root/
โโโ โ๏ธ local.env
โโโ โ๏ธ **staging.env**
๐ c-root/
โโโ โ๏ธ local.env
โโโ โ๏ธ **staging.env**
โโโ โ๏ธ prod.env
When the extension detects an m.workspace, clicking the button in the status bar or running the .ENV Switcher: Select preset
command will open this sidebar panel.
For example, if the toggle is enabled, and I click on any of the local.env
entries, all sub-roots will try to switch to a preset named local.env
. Will not change a sub-root target content if a preset with the same name wasn't found.
This issue doesn't deal with the implementation of m.workspaces, although it will be affected by and influence the chosen solution.
I'll leave this issue pinned to try and gather input, which is very welcome.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.