Skip to content

Conversation

@yaaax
Copy link
Contributor

@yaaax yaaax commented Aug 7, 2025

Description

VSCodium does not set VSCODE_PID so it was not detected as a dev environment.

The code now checks if there is at least one environment variable starting with "VSCODE_" (there are a few ones on VSCodium)

Linked Issues

Fixes #747

Additional context

I was investigating why my editor was falling into this kind of error: "eslint RangeError: Error while loading rule 'prefer-const': Maximum call stack size exceeded".

@netlify
Copy link

netlify bot commented Aug 7, 2025

Deploy Preview for melodious-froyo-4871f8 ready!

Name Link
🔨 Latest commit 44f213e
🔍 Latest deploy log https://app.netlify.com/projects/melodious-froyo-4871f8/deploys/68ef11c6f43f9f000869fbaa
😎 Deploy Preview https://deploy-preview-748--melodious-froyo-4871f8.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

src/utils.ts Outdated
return !!(false
|| process.env.VSCODE_PID
|| process.env.VSCODE_CWD
|| Object.keys(process.env).find(value => /^VSCODE_.*/.test(value))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is way too broad and easy to lead to false positives. I'd prefer to list more known envs hard-coded.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

Maybe process.env.TERM_PROGRAM === "vscode"?
This one is set in my VSCodium environment.

See code in addTerminalEnvironmentKeys function.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

Copy link
Contributor Author

@yaaax yaaax Aug 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi there,
I‘ve modified the code accordingly (see 8110667).

VSCodium does not set `VSCODE_PID` so it was not detected as a dev
environment.
The code now checks if "TERM_PROGRAM" variable is set to `vscode`
instead.
See [code in `addTerminalEnvironmentKeys` function](https://github.com/microsoft/vscode/blob/3c257409f43577bc797a94acee32b9213b382958/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts#L62)
return !!(false
|| process.env.VSCODE_PID
|| process.env.VSCODE_CWD
|| process.env.TERM_PROGRAM === "vscode"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep the oringal ones and add this as an addotion

@antfu antfu merged commit 8123694 into antfu:main Oct 15, 2025
3 of 4 checks passed
antfu added a commit that referenced this pull request Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VSCODE_PID is not present in VSCodium

2 participants