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

Failed to create connection to server with version 0.1.30 #725

Closed
Carryme1899 opened this issue Nov 14, 2024 · 5 comments
Closed

Failed to create connection to server with version 0.1.30 #725

Carryme1899 opened this issue Nov 14, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@Carryme1899
Copy link

As described in #722 (comment), it seems that the --clang-tidy-checks argument causing the issue.

Removing the argument or updating to 0.1.31 resolves the problem.

clangd output:

The flag `-clang-tidy-checks` is obsolete and ignored.
clangd: Unknown command line argument 'bugprone-*,'.  Try: '/usr/bin/clangd --help'
clangd: Unknown command line argument 'misc-*,'.  Try: '/usr/bin/clangd --help'
clangd: Unknown command line argument 'google-*,'.  Try: '/usr/bin/clangd --help'
clangd: Unknown command line argument 'modernize-*,'.  Try: '/usr/bin/clangd --help'
clangd: Unknown command line argument 'readability-*,'.  Try: '/usr/bin/clangd --help'
clangd: Unknown command line argument 'portability-*'.  Try: '/usr/bin/clangd --help'
[Info  - 4:08:33 PM] Connection to server got closed. Server will restart.
[Error - 4:08:33 PM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 4:08:33 PM] Clang Language Server client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 

Settings in .vscode/settings.json:

"clangd.arguments": [
    "--all-scopes-completion",
    "--background-index",
    "--clang-tidy",
    "--clang-tidy-checks=performance-*, bugprone-*, misc-*, google-*, modernize-*, readability-*, portability-*",
    "--compile-commands-dir=${workspaceFolder}/.vscode",
    "--completion-parse=auto",
    "--completion-style=detailed",
    "--enable-config",
    "--fallback-style=Microsoft",
    "--function-arg-placeholders=true",
    "--header-insertion-decorators",
    "--header-insertion=never",
    "--log=verbose",
    "--pch-storage=memory",
    "--pretty",
    "--ranking-model=decision_forest",
    "-j=8"
],
  • clangd version: 18.1.8 (Fedora 18.1.8-1.fc40)
  • OS: Fedora 40
@Carryme1899 Carryme1899 added the bug Something isn't working label Nov 14, 2024
@HighCommander4
Copy link
Contributor

I can reproduce this with 0.1.30, but not with 0.1.29.

I believe the underlying cause is the same as #722, which was regressed in 0.1.30 and fixed in 0.1.31.


That said, please note the following in the output:

The flag -clang-tidy-checks is obsolete and ignored.

Even with 0.1.31, the clangd server is going to ignore this flag.

Clang-tidy checks can be enabled using the config file instead, e.g.

Diagnostics:
  ClangTidy:
    Add: [
      performance-*,
      bugprone-*,
      misc-*,
      google-*,
      modernize-*,
      readability-*,
      portability-*
    ]

@Carryme1899
Copy link
Author

Oops! Sorry for the mix-up. This issue’s in version 0.1.30.
I have a .clang-tidy file for diagnostics. The flag in settings.json was just left over from an old setup I forgot to remove.

@Carryme1899 Carryme1899 changed the title Failed to create connection to server with version 0.1.29 Failed to create connection to server with version 0.1.30 Nov 15, 2024
@HighCommander4
Copy link
Contributor

HighCommander4 commented Nov 15, 2024

Great! Then this is just a dupe of #722.

@JVApen
Copy link
Contributor

JVApen commented Nov 15, 2024

The problem seems to be with the spaces in the command line option. These are not needed and if you remove them, this also works with version 0.1.30

@HighCommander4
Copy link
Contributor

The problem seems to be with the spaces in the command line option. These are not needed and if you remove them, this also works with version 0.1.30

Note that there are legitimate use cases for having spaces in command line options, e.g.:

  "clangd.arguments": [
    "--query-driver=C:/Program Files/MinGW/bin/gcc.exe"
  ]

There are users who have things like this in their settings today, and we don't want to break them, so it's important that a revised fix for #683 keeps things like this working.

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

No branches or pull requests

3 participants