Skip to content
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

Regression with clangd.restart command #739

Closed
k0zmo opened this issue Dec 3, 2024 · 2 comments · Fixed by #743
Closed

Regression with clangd.restart command #739

k0zmo opened this issue Dec 3, 2024 · 2 comments · Fixed by #743
Labels
bug Something isn't working

Comments

@k0zmo
Copy link
Contributor

k0zmo commented Dec 3, 2024

Installing this extension on a fresh VS code, I get a prompt asking me if I want to get clangd installed. After the installation is done it asks about reloading the whole window. Until version 0.1.32 I could simply ignore it and run manually clangd: Restart language server. This is much faster, especially when running in devcontainer. Starting with 0.1.32 this is no longer valid. Upon invocation of restart command I get an error telling me that clangd.install is already registered:

Command 'clangd: Restart language server' resulted in an error. command 'clangd.install' already exists

I guess to problem stems from the changes in the commit 4da3e1e. In new version, in function ClangdContext.create we call install.activate passing the subscriptions object which is then used to store the results of vscode.commands.registerCommand. However, when clangd is not found at this point we return. The next time we call restart we'll try to do the same. We call dispose but it doesn't know anything about the previous subscriptions.

Finally, my question is - do we really need to reload the whole window? Am I missing something by just restarting a server? If not, maybe we could think about changing this behaviour?

Logs

2024-12-03 20:16:47.461 [info] Extension host with pid 75562 started
2024-12-03 20:16:47.471 [info] Lock '/home/dev/.vscode-server/data/User/workspaceStorage/b6d13464d5fc5822dc898f6c3a88d69a/vscode.lock': Lock acquired.
2024-12-03 20:16:47.502 [info] ExtensionService#_doActivateExtension vscode.emmet, startup: false, activationEvent: 'onLanguage'
2024-12-03 20:16:47.503 [info] ExtensionService#_doActivateExtension vscode.configuration-editing, startup: false, activationEvent: 'onLanguage:jsonc'
2024-12-03 20:16:47.503 [info] ExtensionService#_doActivateExtension vscode.json-language-features, startup: false, activationEvent: 'onLanguage:jsonc'
2024-12-03 20:16:47.503 [info] ExtensionService#_doActivateExtension vscode.typescript-language-features, startup: false, activationEvent: 'onLanguage:jsonc'
2024-12-03 20:16:47.800 [info] ExtensionService#_doActivateExtension llvm-vs-code-extensions.vscode-clangd, startup: false, activationEvent: 'onLanguage:cpp'
2024-12-03 20:16:47.971 [info] ExtensionService#_doActivateExtension vscode.git-base, startup: true, activationEvent: '*', root cause: vscode.git
2024-12-03 20:16:47.971 [info] ExtensionService#_doActivateExtension mhutchie.git-graph, startup: true, activationEvent: '*'
2024-12-03 20:16:47.994 [info] ExtensionService#_doActivateExtension ms-dotnettools.vscode-dotnet-runtime, startup: true, activationEvent: 'workspaceContains:CMakeLists.txt', root cause: josetr.cmake-language-support-vscode
2024-12-03 20:16:48.071 [info] ExtensionService#_doActivateExtension ms-vscode.cmake-tools, startup: true, activationEvent: 'workspaceContains:CMakeLists.txt'
2024-12-03 20:16:48.289 [info] ExtensionService#_doActivateExtension vscode.git, startup: true, activationEvent: '*'
2024-12-03 20:16:48.289 [info] ExtensionService#_doActivateExtension vscode.github, startup: true, activationEvent: '*'
2024-12-03 20:16:48.425 [info] ExtensionService#_doActivateExtension josetr.cmake-language-support-vscode, startup: true, activationEvent: 'workspaceContains:CMakeLists.txt'
2024-12-03 20:16:49.218 [info] Eager extensions activated
2024-12-03 20:16:49.218 [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch, startup: false, activationEvent: 'onStartupFinished'
2024-12-03 20:16:49.218 [info] ExtensionService#_doActivateExtension vscode.merge-conflict, startup: false, activationEvent: 'onStartupFinished'
2024-12-03 20:16:49.219 [info] ExtensionService#_doActivateExtension vadimcn.vscode-lldb, startup: false, activationEvent: 'onStartupFinished'
2024-12-03 20:17:06.778 [error] Error: command 'clangd.install' already exists
	at Y0.registerCommand (file:///vscode/vscode-server/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/vs/workbench/api/node/extensionHostProcess.js:114:31527)
	at Object.registerCommand (file:///vscode/vscode-server/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/vs/workbench/api/node/extensionHostProcess.js:156:36491)
	at /home/dev/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:43:12051
	at Generator.next (<anonymous>)
	at /home/dev/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:1:1240
	at new Promise (<anonymous>)
	at De (/home/dev/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:1:1060)
	at activate (/home/dev/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:43:11982)
	at ClangdContext.<anonymous> (/home/dev/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:46:9890)
	at Generator.next (<anonymous>)
	at /home/dev/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:1:1240
	at new Promise (<anonymous>)
	at De (/home/dev/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:1:1060)
	at ClangdContext.create (/home/dev/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:46:9848)
	at /home/dev/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:46:12378
	at Generator.next (<anonymous>)
	at /home/dev/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:1:1240
	at new Promise (<anonymous>)
	at De (/home/dev/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:1:1060)
	at /home/dev/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:46:12301
	at Y0.h (file:///vscode/vscode-server/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/vs/workbench/api/node/extensionHostProcess.js:114:32833)
	at Y0.$executeContributedCommand (file:///vscode/vscode-server/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/vs/workbench/api/node/extensionHostProcess.js:114:33683)
	at py.S (file:///vscode/vscode-server/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/vs/workbench/api/node/extensionHostProcess.js:31:155639)
	at py.Q (file:///vscode/vscode-server/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/vs/workbench/api/node/extensionHostProcess.js:31:155419)
	at py.M (file:///vscode/vscode-server/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/vs/workbench/api/node/extensionHostProcess.js:31:154508)
	at py.L (file:///vscode/vscode-server/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/vs/workbench/api/node/extensionHostProcess.js:31:153613)
	at mh.value (file:///vscode/vscode-server/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/vs/workbench/api/node/extensionHostProcess.js:31:152410)
	at P.B (file:///vscode/vscode-server/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/vs/workbench/api/node/extensionHostProcess.js:29:746)
	at P.fire (file:///vscode/vscode-server/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/vs/workbench/api/node/extensionHostProcess.js:29:964)
	at Vn.fire (file:///vscode/vscode-server/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/vs/workbench/api/node/extensionHostProcess.js:31:9457)
	at mh.value (file:///vscode/vscode-server/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/vs/workbench/api/node/extensionHostProcess.js:174:13300)
	at P.B (file:///vscode/vscode-server/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/vs/workbench/api/node/extensionHostProcess.js:29:746)
	at P.fire (file:///vscode/vscode-server/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/vs/workbench/api/node/extensionHostProcess.js:29:964)
	at Vn.fire (file:///vscode/vscode-server/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/vs/workbench/api/node/extensionHostProcess.js:31:9457)
	at Fm.A (file:///vscode/vscode-server/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/vs/workbench/api/node/extensionHostProcess.js:31:12573)
	at mh.value (file:///vscode/vscode-server/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/vs/workbench/api/node/extensionHostProcess.js:31:10993)
	at P.B (file:///vscode/vscode-server/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/vs/workbench/api/node/extensionHostProcess.js:29:746)
	at P.fire (file:///vscode/vscode-server/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/vs/workbench/api/node/extensionHostProcess.js:29:964)
	at j5.acceptChunk (file:///vscode/vscode-server/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/vs/workbench/api/node/extensionHostProcess.js:31:7940)
	at mh.value (file:///vscode/vscode-server/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/vs/workbench/api/node/extensionHostProcess.js:31:7226)
	at P.B (file:///vscode/vscode-server/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/vs/workbench/api/node/extensionHostProcess.js:29:746)
	at P.fire (file:///vscode/vscode-server/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/vs/workbench/api/node/extensionHostProcess.js:29:964)
	at V2.z (file:///vscode/vscode-server/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/vs/workbench/api/node/extensionHostProcess.js:31:21944)
	at V2.acceptFrame (file:///vscode/vscode-server/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/vs/workbench/api/node/extensionHostProcess.js:31:21750)
	at W2.n (file:///vscode/vscode-server/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/vs/workbench/api/node/extensionHostProcess.js:31:20278)
	at file:///vscode/vscode-server/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/vs/workbench/api/node/extensionHostProcess.js:31:17510
	at Socket.t (file:///vscode/vscode-server/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/vs/workbench/api/node/extensionHostProcess.js:31:15451)
	at Socket.emit (node:events:519:28)
	at addChunk (node:internal/streams/readable:559:12)
	at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
	at Readable.push (node:internal/streams/readable:390:5)
	at TCP.onStreamRead (node:internal/stream_base_commons:191:23) clangd.restart {"value":"llvm-vs-code-extensions.vscode-clangd","_lower":"llvm-vs-code-extensions.vscode-clangd"}

System information
Clangd version: clangd version 18.1.3 (https://github.com/llvm/llvm-project c13b7485b87909fcf739f62cfa382b55407433c0)
clangd extension version: 0.1.33
Operating system: Linux, Windows

@HighCommander4
Copy link
Contributor

Thanks for the report and diagnosis! I put up a fix at #743.

Finally, my question is - do we really need to reload the whole window? Am I missing something by just restarting a server? If not, maybe we could think about changing this behaviour?

Could you file a separate issue for this please, so it's not forgotten?

@k0zmo
Copy link
Contributor Author

k0zmo commented Dec 4, 2024

Thanks for taking care of that really fast.

Could you file a separate issue for this please, so it's not forgotten?

Sure thing - #744

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants