clangd / vscode-clangd

Visual Studio Code extension for clangd
https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd
MIT License
594 stars 97 forks source link

'clangd' language server can't be found after interruption of remote session. #583

Open makxenov opened 5 months ago

makxenov commented 5 months ago

I use clangd extension installed on remote (SSH) server. It works fine until I let my laptop go to sleep mode. When I'm resuming my work after a while, VSCode suggests me to reload the window, because the connection was lost. And after the reload I get a message that the language server can't be found, so it suggests to download the binary. But it is still installed on the server, and I have 'clangd.path' written to ${workspaceFolder}/.vscode/settings.json file.

The only way to fix the problem that I found is: Disable 'clangd' extension -> Reload the window -> Enable the extension again. After that sequence the language server launches successfully, which proves that my workspace is configured correctly. But I would like to find a better fix, because it's very annoying to reenable the extension several times a day.

"settings.json" file in the workspace

{
    "clangd.arguments": [
        "--background-index",
        "--compile-commands-dir=/home/maksenov/obj/blueprint",
        "--header-insertion=never"
    ],
    "clangd.path": "/home/maksenov/.vscode-server/data/User/globalStorage/llvm-vs-code-extensions.vscode-clangd/install/17.0.3/clangd_17.0.3/bin/clangd"
}

Logs I have only the message "The 'clangd' language server was not found on your PATH. Would you like to ...". The clangd log from the "Output" window is empty.

System information clangd version 17.0.3 (https://github.com/llvm/llvm-project 888437e1b60011b8a375dd30928ec925b448da57) clangd extension version: 0.1.26 Operating system: Remote: Linux Ubuntu 20.04, Local: MacOS 12.6.5