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

question about clangd installed by xcode command line tools #23

Open
zwyyy456 opened this issue Jan 14, 2024 · 1 comment
Open

question about clangd installed by xcode command line tools #23

zwyyy456 opened this issue Jan 14, 2024 · 1 comment

Comments

@zwyyy456
Copy link

Troubleshooting: clangd

Version

  • LSP: 1.27.0
  • Sublime Text: 4169

Server Test Run

  • exit code: 0
  • output
I[16:43:03.915] Apple clangd version 15.0.0 (clang-1500.1.0.2.5)
I[16:43:03.916] Features: mac+xpc
I[16:43:03.916] PID: 4171
I[16:43:03.916] Working directory: /Applications/Sublime Text.app/Contents/MacOS
I[16:43:03.916] argv[0]: /Library/Developer/CommandLineTools/usr/bin/clangd
I[16:43:03.916] argv[1]: --pretty=true
I[16:43:03.916] argv[2]: --clang-tidy=true
I[16:43:03.916] Starting LSP over stdin/stdout

Server Configuration

  • command
[
  "/usr/bin/clangd", 
  "--pretty=true", 
  "--clang-tidy=true"
]
  • shell command
/usr/bin/clangd --pretty=true --clang-tidy=true
  • selector
source.c | source.c++ | source.objc | source.objc++ | source.cuda-c++
  • priority_selector
source.c | source.c++ | source.objc | source.objc++ | source.cuda-c++
  • init_options
{
  "clangd": {
    "all-scopes-completion": null, 
    "background-index": null, 
    "background-index-priority": null, 
    "clang-tidy": true, 
    "compile-commands-dir": null, 
    "completion-style": null, 
    "enable-config": null, 
    "fallback-style": null, 
    "function-arg-placeholders": null, 
    "header-insertion": null, 
    "header-insertion-decorators": null, 
    "limit-references": null, 
    "limit-results": null, 
    "log": null, 
    "malloc-trim": null, 
    "number-workers": null, 
    "path-mappings": null, 
    "pch-storage": null, 
    "pretty": true, 
    "project-root": null, 
    "query-driver": null, 
    "remote-index-address": null
  }, 
  "clangdFileStatus": false, 
  "fallbackFlags": []
}
  • settings
{}
  • env
{}

Active view

  • File name
/Users/zwyyy/Documents/code/leetcode/cpp/2085.count-common-words-with-one-occurrence/solution.cpp
  • Settings
{
  "auto_complete_selector": "meta.tag, source - comment - string.quoted.double.block - string.quoted.single.block - string.unquoted.heredoc", 
  "lsp_active": true, 
  "syntax": "Packages/C++/C++.sublime-syntax"
}
  • base scope
source.c++

Project / Workspace

  • folders
[]
  • is project: False

LSP configuration

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

System PATH

  • /opt/homebrew/bin
  • /opt/homebrew/sbin
  • /usr/local/bin
  • /System/Cryptexes/App/usr/bin
  • /usr/bin
  • /bin
  • /usr/sbin
  • /sbin
  • /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin
  • /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin
  • /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin
  • /opt/homebrew/opt/llvm/bin
  • /opt/homebrew/opt/postgresql@15/bin
  • /opt/homebrew/bin
  • /opt/homebrew/Caskroom/miniconda/base/bin
  • /opt/homebrew/Caskroom/miniconda/base/condabin
  • /Users/zwyyy/.orbstack/bin

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
Copy link
Collaborator

LDAP commented Jan 14, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants