Coder Social home page Coder Social logo

ecksdy / vscode-env-switcher Goto Github PK

View Code? Open in Web Editor NEW
9.0 1.0 5.0 1.38 MB

The repo for .ENV Switcher VSCode extension

Home Page: https://marketplace.visualstudio.com/items?itemName=EcksDy.env-switcher

License: MIT License

TypeScript 50.73% Shell 0.06% JavaScript 4.08% HTML 34.92% Svelte 10.22%
environment-variables environments vscode vscode-extension

vscode-env-switcher's Introduction

personal site   personal site   linkedin   stackoverflow

I'm Yury - aka the Software Magician 🧙‍♂️

Welcome to my little corner of GitHub! I'm a full-stack developer with a knack for backend infrastructure. Think of me as the wizard behind the curtain, making sure everything runs like a well-oiled machine. I'm a big fan of automation, and I'll turn mountains upside down to make my life easier. I love breaking stuff apart, and with time I've got better at putting it back together.

💻 Professional Background

Let's be honest, there's no such thing as a full-stack developer. You're either a frontend dev who can work the server, or a backend dev who can solve client problems. I fall into the latter category. Working in startups, I've had to wear many hats, and I've learned to be comfortable with the uncomfortable. I've worked on everything from frontend to backend, from infrastructure to devops, and led features from product to production ✨

I've learned to be a jack of all trades, and a master of some.

My journey in tech has led me to work extensively with relational and NoSQL databases, dive deep into the world of AWS, and mastering the art of CI/CD pipelines. Docker and Kubernetes are additional tools that I carry on my belt. I can talk shop with most devops guys, and even understand most of their black magic.

My experience has shaped me into a versatile developer, capable of tackling diverse challenges in the ever-evolving landscape of web development.

🎮 Hobbies and Interests

When I'm not on the job, you can find me:

  • 🕹️ Gaming, nothing like a good match with a couple of friends
  • 📚 Reading sci-fi and fantasy novels, with some books on productivity sprinkled in
  • 📸 Snapping photos
  • 🔧 Tinkering with extensions, tools, plugins
  • 🧩 Solving puzzles
  • 🛠️ DIYing around the house
  • 🏡 Venturing into the realm of home automation

📊 Fun Facts

  • I'm your go-to guy if you need help reaching the top shelf. #tall-people-problems
  • Sushi enthusiast 🍣 - I could probably live off of it!
  • As a kid, I had a collection of 50+ paper airplane designs 🛩️

vscode-env-switcher's People

Contributors

dependabot[bot] avatar ecksdy avatar estenori avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

vscode-env-switcher's Issues

Comand '.ENV Switcher: Select preset' resulted in an error

This is the error I get after running the command:
image

These are my .env files which I have in the root:
image

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?

Discussing a UI solution for multiroot/monorepo workspaces

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.

  • The preset names are irrelevant, this is only for demonstration purposes.
  • The asterisked presets are the currently selected presets per project and will be distinctly highlighted.
  • Clicking on another preset will switch the sub-root target file to that preset.
  • A toggle button at the top, when enabled will try to switch to the selected preset in all sub-roots.

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.

Support multiroot workspaces

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

  • also weird: it overwrote the .env file with content from a compleetly different root fodler which should never happen

Error running any .ENVSwitcher commands

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]

image

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

env switcher updates wrong .env file

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!

Alert before altering .env

As discussed in #27 (comment)

  • Enable an Alert box when switching env with content something like this: 'You are about to permanently overwrite the contents of {full_env_file_path}. This cannot be reversed/undone. Please read the docs for more info. OK/cancel'
  • Alert should be on by default to avoid first time users being surprised by behaviour.
  • Allow the alert to be turned off via the extension config once you are happy with .envswitcher workflow.

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.

Allow us to specify the environment file name

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

Add more .env files for the switcher

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.