question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`vscode.env.shell` might return empty string to extension if fetched very soon after startup

See original GitHub issue

Type: Bug

Seems to be a timing issue. The following steps sometimes reproduce it for me, but success may depend on the performance of your workstation (mine is Windows) and which other extensions are enabled by default.

  1. Clone https://github.com/gjsjohnmurray/vscode-extension-samples/tree/show-160694
  2. Open the statusbar-sample folder in VS Code
  3. Open a Terminal in that folder and run npm install
  4. Switch to Debug view, choose the ONLY Extension configuration and run it. This launches with --disable-extensions
  5. When Extension Host window appears, look on the right of the status bar. If the repro was successful it will look like this:

image

If this doesn’t happen, try the next steps:

  1. End debugging and launch the Extension configuration instead. This launches normally and probably won’t trigger the problem:

image

  1. From Command Palette of the EH window, run Developer: Reload With Extensions Disabled. With luck this will cause the problem to happen (see first screenshot).

The extension activates "*", so immediately on startup. The first attempt to get vscode.env.shell happens from its activate method.

If the problem shows, click the status bar panel to get the value again. This time it should succeed.

VS Code version: Code - Insiders 1.72.0-insider (835ace5796cec0ed19a7eec119b26b57220b0f1a, 2022-09-12T05:16:16.290Z) OS version: Windows_NT x64 10.0.22000 Modes: Sandboxed: Yes

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:18 (18 by maintainers)

github_iconTop GitHub Comments

2reactions
Tyriarcommented, Sep 15, 2022

@meganrogge since things can be achieved with this upcoming change (check creationOptions or env.shell/onDidChangeShell), I’m not sure we want to add more to the API just to handle this case.

1reaction
jriekencommented, Sep 14, 2022

Leaving this open for future finalization

Read more comments on GitHub >

github_iconTop Results From Across the Web

VS Code API | Visual Studio Code Extension API
VS Code API is a set of JavaScript APIs that you can invoke in your Visual Studio Code extension. This page lists all...
Read more >
September 2022 (version 1.72) - Visual Studio Code
Learn what is new in the Visual Studio Code September 2022 Release (1.72)
Read more >
November 2022 (version 1.74) - Visual Studio Code
Install an extension located on disk​​ command. The command will open the platform folder dialog to select the location of the extension's ....
Read more >
User and Workspace Settings - Visual Studio Code
Note: VS Code extensions can also add their own custom settings, and those ... Or, if workbench.settings.editor is set to json , now...
Read more >
Troubleshoot Terminal launch failures - Visual Studio Code
Troubleshooting steps · Test your shell directly. Try running your designated integrated terminal shell outside VS Code from an external terminal or command ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found