1

I've setup lsp-mode and clangd, and put the compile-commands.json in the projects root.

I can tell compile-commands.json because my cflags are included in the Updating file output of *clangd::stderr* log.


However, whenever I run lsp-find-definition it simply prints:
lsp-request: method not found

... unless the function happens to be defined in the same file.


How to troubleshoot this? it makes lsp-mode quite useless.

Checking the logs gives no hints as to why it fails to find the method.


For reference this is the output of lsp-describe-session:

[-] /src/blender/
 `-[-] clangd:22663
    |-[-] Buffers
    |  |-[+] BKE_blender.h
    |  `-[+] creator.c
    `-[-] Capabilities
       |-[X] workspaceSymbolProvider: t
       |-[X] textDocumentSync: 2
       |-[-] signatureHelpProvider:
       |  `-[X] triggerCharacters: [( ,]
       |-[X] renameProvider: t
       |-[X] referencesProvider: t
       |-[X] hoverProvider: t
       |-[-] executeCommandProvider:
       |  `-[X] commands: [clangd.applyFix]
       |-[X] documentSymbolProvider: t
       |-[X] documentRangeFormattingProvider: t
       |-[-] documentOnTypeFormattingProvider:
       |  |-[X] moreTriggerCharacter: []
       |  `-[X] firstTriggerCharacter: }
       |-[X] documentHighlightProvider: t
       |-[X] documentFormattingProvider: t
       |-[X] definitionProvider: t
       |-[-] completionProvider:
       |  |-[X] triggerCharacters: [. > :]
       |  `-[X] resolveProvider: nil
       `-[X] codeActionProvider: t

1 Answer 1

0

Do lsp-describe-session and expand server capabilities. This view also displays information about file->buffer associations. My guess is that you do not have a language server associated with that buffer.

3
  • 1
    Added output of lsp-describe-session, note that I managed to get ccls working (out of the box).
    – ideasman42
    Commented Sep 7, 2019 at 15:04
  • I have this same problem. and ccls works. so just witch to ccls.
    – ngn999
    Commented Feb 19, 2022 at 17:01
  • even eglot + clangd works, maybe it's a bug about lsp-mode?
    – ngn999
    Commented Feb 20, 2022 at 5:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.