sublimelsp / LSP-clangd

C/C++ support for Sublime's LSP plugin provided through clangd.
MIT License
43 stars 1 forks source link

question about clangd installed by xcode command line tools #23

Open zwyyy456 opened 9 months ago

zwyyy456 commented 9 months ago

Troubleshooting: clangd

Version

Active view

Project / Workspace

LSP configuration

{
  "lsp_format_on_save": true, 
  "show_code_actions": "bulb"
}

System PATH

problem description

There are server clangd in my m1pro mac. One in /usr/bin, which may be installed by xcode command line tools. The other is in /opt/homebrew/opt/llvm/bin,which is installed by brew install llvm. I just install lsp and lsp-clangd package in sb4. It worked well in the past. The lsp-clangd.sublime-settings is as follow:

  "initializationOptions": {
      "clangd.clang-tidy": true,
      "clangd.pretty": true,
}

One day, I found that when I include <cassert>, it shows that cassert file not found. I don't know why this happed.

The way I solve this problem is change the lsp-clangd.sublime-settings as follows:

{
    "binary": "custom",
    "initializationOptions": {
        "clangd.clang-tidy": true,
        "clangd.pretty": true,
        "custom_command": [
            "/opt/homebrew/opt/llvm/bin/clangd"
        ]
    }
}

Why my previous lsp-clangd settings doesn't work well?

LDAP commented 9 months ago

Sounds like an issue with your clangd installation in /usr/bin.