pylance-release icon indicating copy to clipboard operation
pylance-release copied to clipboard

Setting `python.analysis.nodeExecutable` in the user settings affects how pylance gets launched on VSCode remote

Open fsouza opened this issue 1 year ago • 6 comments

Opening as a question because I'm not sure if I'm doing something wrong or not. I sometimes use VSCode locally, and other times I use it remote (different use cases). The problem is that when I set python.analysis.nodeExecutable in the user settings, pylance tries to use that path on the remote server, despite the user settings graying out the setting, which implies that it shouldn't be used on remote?

For example, assuming I set python.analysis.nodeExecutable to /opt/homebrew/opt/node@20/bin/node on macOS, and then try to connect to a remote, Pylance fails to start with the error message:

2024-04-26 19:26:48.835 [info] (Client) Pylance async client (2024.4.1) started with python extension (2024.4.1)
2024-04-26 19:26:48.856 [info] [Error - 7:26:48 PM] Pylance client: couldn't create connection to server.
2024-04-26 19:26:48.856 [info] Launching server using command /opt/homebrew/opt/node@20/bin/node failed. Error: spawn /opt/homebrew/opt/node@20/bin/node ENOENT

If I open the user settings, python.analysis.nodeExecutable is grayed out with a message that reads "This setting cannot be applied in this window. It will be applied when you open a local window.", which is a bit confusing. Screenshot:

image

Is that the expected behavior or am I doing something wrong?

fsouza avatar Apr 26 '24 19:04 fsouza

ah, sounds like a bug. we should ignore this when it is used in remote. putting it in triage so we can determine when we should fix this.

heejaechang avatar Apr 26 '24 19:04 heejaechang

On the remote machine you should be using the machine wide settings.json. For me that's somewhere like so:

/home/user/.vscode-server/Machine/settings.json

This settings.json should take precedence over the user settings.json.

I think the bug here is we're picking up the local setting if the remote setting isn't set.

rchiodo avatar May 07 '24 18:05 rchiodo

On the remote machine you should be using the machine wide settings.json. For me that's somewhere like so:

BTW I tried that and it still tries to use the nodeExecutable from my local user settings, not the one in Machine/settings.json. Do I need to restart vscode-server for it to reflect?

edit: still didn't work after restarting vscode-server

fsouza avatar Aug 01 '24 16:08 fsouza

can we see content of setting.json for your local and remote ?

heejaechang avatar Aug 01 '24 17:08 heejaechang

Ughh good call, I had the incorrect machine settings. Sorry about that.

fsouza avatar Aug 01 '24 18:08 fsouza