Skip to content

Conversation

@Sysix
Copy link
Member

@Sysix Sysix commented Oct 28, 2025

see #14920 (comment)

When Node.js isn't on the PATH by default but rather added dynamically by a 3rd-party tool (mostly to manage on-the-fly multiple Node versions), the type aware checking in the VS Code extension will fail to run.

Copy link
Member Author

Sysix commented Oct 28, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added A-editor Area - Editor and Language Server C-enhancement Category - New feature or request labels Oct 28, 2025
@Sysix
Copy link
Member Author

Sysix commented Oct 28, 2025

@EDM115 could you test this option if this works for you with fnm :)?

@EDM115
Copy link

EDM115 commented Nov 1, 2025

yes it does :)

@EDM115
Copy link

EDM115 commented Nov 1, 2025

once again I know that this is an FNM issue, but with the latest release being nearly a year old I don't expect anything from that side.
the only "advantage" of my solution was an automatic retrieval of the path to the node installation but I guess that this one gives more control since we can change this setting per workspace and match the path of different node versions

@Sysix Sysix force-pushed the 10-28-feat_editor_add_oxc.path.node_option branch from 3406ed2 to 06520d7 Compare November 4, 2025 17:47
@Sysix Sysix requested a review from Copilot November 4, 2025 17:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for configuring a custom Node.js binary path that will be prepended to the language server's PATH environment variable. This allows users to specify a particular Node.js installation to be used by the Oxc language server.

Key changes:

  • Added a new oxc.path.node configuration option for specifying a Node.js binary path
  • Implemented the configuration getter/setter in VSCodeConfig
  • Modified the server startup logic to prepend the Node.js path to the PATH environment variable

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
editors/vscode/package.json Relocated oxc.path.server configuration and added new oxc.path.node configuration property
editors/vscode/client/VSCodeConfig.ts Added nodePath property and related getter/setter methods to VSCodeConfig class and interface
editors/vscode/client/extension.ts Modified server environment setup to include the custom Node.js path in the PATH environment variable
editors/vscode/tests/VSCodeConfig.spec.ts Updated tests to include path.node in test setup/teardown and added assertions for the new property
editors/vscode/README.md Added documentation for the new oxc.path.node configuration option

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Sysix Sysix force-pushed the 10-28-feat_editor_add_oxc.path.node_option branch from 06520d7 to bea7796 Compare November 4, 2025 18:07
@Sysix Sysix marked this pull request as ready for review November 4, 2025 18:08
@Sysix Sysix requested a review from camc314 as a code owner November 4, 2025 18:08
RUST_LOG: process.env.RUST_LOG || 'info',
};
if (nodePath) {
serverEnv.PATH = `${nodePath}${process.platform === 'win32' ? ';' : ':'}${process.env.PATH ?? ''}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

The documentation states nodePath is a "Path to a Node.js binary" (e.g., /usr/local/bin/node), but the code adds it directly to PATH without extracting the directory. PATH environment variables should contain directories, not file paths. This will cause the PATH to be malformed if users follow the documentation.

Fix: Extract the directory from the binary path:

if (nodePath) {
  const nodeDir = require('path').dirname(nodePath);
  serverEnv.PATH = `${nodeDir}${process.platform === 'win32' ? ';' : ':'}${process.env.PATH ?? ''}`;
}

Alternatively, update the documentation to clarify that users should provide the directory path, not the binary path.

Suggested change
serverEnv.PATH = `${nodePath}${process.platform === 'win32' ? ';' : ':'}${process.env.PATH ?? ''}`;
if (nodePath) {
const nodeDir = require('path').dirname(nodePath);
serverEnv.PATH = `${nodeDir}${process.platform === 'win32' ? ';' : ':'}${process.env.PATH ?? ''}`;
}

Spotted by Graphite Agent

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-editor Area - Editor and Language Server C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants