Giter Club home page Giter Club logo

Comments (4)

AleksanderGondek avatar AleksanderGondek commented on May 28, 2024 1

Thank you for taking time to report this, I thought I had been going crazy.

from nix-env-selector.

rectcircle avatar rectcircle commented on May 28, 2024 1

microsoft/vscode#152806

from nix-env-selector.

rectcircle avatar rectcircle commented on May 28, 2024

I also encountered the same problem.

I read the source code of this extension. I think this is an underlying flaw of this extension, related to the VSCode extension activation order.

In order to start fast enough, VSCode does not provide an API to define the order of extension activation.

Therefore, in some cases, other extensions will start before this extension completes env/set-current-env.

(env/set-current-env))

Taking the Go extension as an example, if I don't open the go source file, it will work fine, the extension host output is:

2023-03-04 17:50:41.355 [info] ExtensionService#_doActivateExtension arrterian.nix-env-selector, startup: false, activationEvent: '*'
2023-03-04 17:50:41.355 [info] ExtensionService#_doActivateExtension mutantdino.resourcemonitor, startup: false, activationEvent: '*'
2023-03-04 17:50:41.356 [info] ExtensionService#_doActivateExtension vscode.extension-editing, startup: false, activationEvent: 'onLanguage:markdown'
2023-03-04 17:50:41.356 [info] ExtensionService#_doActivateExtension vscode.markdown-language-features, startup: false, activationEvent: 'onLanguage:markdown'
2023-03-04 17:50:41.356 [info] ExtensionService#_doActivateExtension DavidAnson.vscode-markdownlint, startup: false, activationEvent: 'onLanguage:markdown'
2023-03-04 17:50:42.638 [info] ExtensionService#_doActivateExtension vscode.git, startup: false, activationEvent: '*'
2023-03-04 17:50:42.638 [info] ExtensionService#_doActivateExtension vscode.github, startup: false, activationEvent: '*'
2023-03-04 17:50:42.816 [info] ExtensionService#_doActivateExtension vscode.markdown-math, startup: false, activationEvent: 'api', root cause: vscode.markdown-language-features
2023-03-04 17:50:42.972 [info] ExtensionService#_doActivateExtension golang.go, startup: true, activationEvent: 'workspaceContains:*.go,*/*.go,*/*/*.go'

If I open the Go source file, the Go extension will report an error, and the extension host output is:

2023-03-04 17:49:58.989 [info] ExtensionService#_doActivateExtension arrterian.nix-env-selector, startup: false, activationEvent: '*'
2023-03-04 17:49:58.989 [info] ExtensionService#_doActivateExtension mutantdino.resourcemonitor, startup: false, activationEvent: '*'
2023-03-04 17:49:58.989 [info] ExtensionService#_doActivateExtension golang.go, startup: false, activationEvent: 'onLanguage:go'

Therefore, I think the implementation of this extension can only completely solve this problem by modifying the user's shell profile to inject environment variables such as PATH. For example ~/.bashrc

if [ $VSCODE_RESOLVING_ENVIRONMENT ]; then
  # source ....
fi

from nix-env-selector.

opeik avatar opeik commented on May 28, 2024

I don't think anything can be done without modifying VSCode. Trying to fix it on the extension side ends up being hacky and buggy.

from nix-env-selector.

Related Issues (20)

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.