remote: autoinstall writes `clangd.path` to the local user config, rather than the remote machine config
VSCode Version: Version: 1.46.0-insider (user setup)
Commit: 288852d
Date: 2020-05-12T05:43:31.363Z
Electron: 7.2.4
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.18363
OS Version: Windows 10
Steps to Reproduce:
Open VS Code insider
Got notification "The Clangd language server was not found on your PATH. Would you like to download and install clangd 10.0.0". Source: clangd (extension). The only choice is INSTALL button (see screen shot)
Click INSTALL. The installation completed without any issue.
Click Reload Window. VS Code insider restarts, but got the same notification in Step 2. Click INSTALL will go back to step 3.
Meanwhile, clangd extension stopps working. It was fully functional yesterday. Screenshots with REMOTE and WORKSPACE Clangd settings.

Just verified clangd extension does not work locally on a Ubuntu 18.04 computer either.
Ah, I think we hadn't properly considered the interaction with remote :-( I tried this out, and what I saw was:
- I got the prompt based on whether the clangd.path binary existed remotely, OK
- the binary was downloaded onto the remote host
- but the
clangd.pathwas written to the local user settings
The issue with your path being tools/clangd seems like #22 - that did indeed work sometimes by accident and doesn't now.
However it's not clear what that should do, I think ${workspaceRoot}/tools/clangd would be clearer and will be supported very soon now.
Yes, the issue is very similar with #22 . We can close this one as duplicate.
Actually there's two issues here.
One is indeed a dupe of #22 (tools/clangd is no longer resolved relative to workspace root) which is now fixed.
The other issue that after installing clangd we write clangd.path to the user config (local ~/.config/Code/settings.json) rather than the machine config (remote ~/.vscode-server/data/Machine/settings.json).
This has two problems:
- if you already have a
clangd.pathin your remote workspace config, then it will take precedence over the local user one. This is why even after installing clangd through the wizard, it didn't work for you. - setting
clangd.pathin your local config, to a path that isn't present on the local machine, means that local clangd won't work.
I'd like to keep this open for the second issue.
Confirmed that this is fixed in v0.1.7.
Looks like it is not fixed in v0.1.7, but broken. Until this version, all steps from this issue were working ok, clangd was installed on remote and clangd.path was updated correctly. But after update same steps lead me to same wrong result: clangd.path is written to local settings (/Users/noxwell/Library/Application Support/Code/User/settings.json) and clangd on remote not work. Remote and workspace settings are empty. I even tried to remove clangd.path from local setting by hand, but autoinstall still writes it here.
Version: 1.49.0
Commit: e790b931385d72cf5669fcefc51cdf65990efa5d
Date: 2020-09-10T17:39:53.251Z
Electron: 9.2.1
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Darwin x64 19.6.0
@noxwell could you provide more details on reproducing the issue?
I didn't reproduce the issue with the following steps:
- open vscode
- connected to the remote machine
- open a c++ file on remote machine (my User/Remote/Workspace clangd setting are empty)
- install dialog is prompted up, and click install
- the clangd path is set in remote setting (~/.vscode-server/data/Machine/settings.json)
@hokein I am also seeing this issue. Host computer: MAC, clangd not installed Remote computer: Linux - RHEL 7, clangd is installed
- open vscode on MAC
- connected to the remote machine
- open a c++ file on remote machine (my setting.json has "clangd.path" configured)
- install dialog is prompted up (even though it shouldn't because it is already installed an in my $PATH)
- click install
- the clangd path is set in LOCAL host setting (/Users/
/Library/Application\ Support/Code/User/settings.json)
cat /Users/<user>/Library/Application\ Support/Code/User/settings.json
{
"files.autoSave": "afterDelay",
"C_Cpp.updateChannel": "Insiders",
"cmake.configureOnOpen": true,
"clangd.path": "/home/<user>/.vscode-server/data/User/globalStorage/llvm-vs-code-extensions.vscode-clangd/install/10.0.0/clangd_10.0.0/bin/clangd",
}%
- Nothing written to remote machine.
- Loop occurs on reload (install dialog is prompted up.... )
- clangd not working on remote machine...
After trying a few combinations, I think I managed to reproduce partially -- it seems only occur when clangd is not installed in remote machine (which clangd reports clangd not found) and there is no "clangd.argument" config in remote setting.json.
Reproduce steps:
-
make sure there is no
clangd.pathconfig in allsetting.json(user setting:/Users/<user>/Library/Application Support/Code/User/settings.json, remote setting:/usr/local/home/<user>/.vscode-server/data/Machine/settings.json), and there is no clangd installed in the remote machine -
open vscode and connected to remote machine
-
open a new
/tmp/t.cppfile -
install dialog is prompted up, and choose to install clangd
-
clangd path is set in user setting (
/Users/<user>/Library/Application Support/Code/User/settings.json)
Interestingly, if we add "clangd.path": "" in remote setting.json, then the clangd.path is set correctly in the remote setting.json -- it seems to me this is a bug in VSCode's WorkspaceConfiguation.update API, it should always update the clangd.path in remote setting.json regardless whether there is clangd.path or not.
A temporary workaround is to set "clangd.path": "clangd" in remote setting.json.
However, I could not reproduce the same issue mentioned by @KCSesh.
(my setting.json has "clangd.path" configured)
which setting.json and what's the value of clangd.path? there are three different setting.jsons
- User setting, the one in host machine, e.g.
/Users/<user>/Library/Application Support/Code/User/settings.json - Remote setting, the one in remote machine, e.g.
/usr/local/home/<user>/.vscode-server/data/Machine/settings.json - (Possible if you open a folder in VSCode) Workspace setting, also in remote machine, e.g.
/usr/local/home/<user>/workspace/llvm-project/.vscode/settings.json
install dialog is prompted up (even though it shouldn't because it is already installed an in my $PATH)
yeah, this should not be happened -- as you have installed clangd in the remote machine, could you verify the command which clangd work in your terminal? could you paste the message shown in the install diaglog, something like The 'clangd' language server was not found on your PATH?
I had the same problem.
As @hokein suggested, setting "clangd.path": "clangd" in remote setting.json (not in settings editior, nor in the local settings.json!) manually then press "install" in the prompt solved the issue. For what's worth, the clangd.path will automatically changed to the installation path after that, like "clangd.path": "/home/kbumsik/.vscode-server/data/User/globalStorage/llvm-vs-code-extensions.vscode-clangd/install/10.0.0/clangd_10.0.0/bin/clangd"
Confirm still having the same problem.
Confirm still having the same problem.
The same.
Confirm still having the same problem.
Issue still the same: Version 1.52.1 (stable release channel)
i'm seeing the same thing. inoperable on remote connection.
my user settings .json is on windows, but it contains a linux path on my remote machine.