Skip to content

Let the server determine cwd on its own #1977

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wagenet
Copy link

@wagenet wagenet commented Feb 5, 2025

Fixes #1727

If cwd is not specified in the ServerOptions then the Language Server will use its own logic to determine the correct working directory, including the root of the workspace. This then allows eslint.runtime to be set to "node" which will be run in the root of the workspace. For projects using tools like Volta, this leads to it using the Volta-specified node version as expected.

@dbaeumer
Copy link
Member

dbaeumer commented Feb 6, 2025

This is for security reasons not so easy. I need to think about the consequences of this and if trusted workspace allow this now. Using the extension host's CWD ensures that no unwanted binary code is loaded.

@dbaeumer
Copy link
Member

dbaeumer commented Feb 6, 2025

What we can always do is to have a opt-in setting for this which we should consider anyways since the change might be a surprise for others.

@wagenet
Copy link
Author

wagenet commented Feb 6, 2025

@dbaeumer opt-in is ok for me. My goal is very much for the process to run in the context of my workspace.

@wagenet
Copy link
Author

wagenet commented Mar 6, 2025

@dbaeumer do you have any guidance on how to implement this? I'd still love to see this happen but my understanding of the codebase is pretty limited.

@dbaeumer
Copy link
Member

dbaeumer commented Mar 7, 2025

Here are some pointers:

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.

Prefer to use node from environment
2 participants