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

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.

  • Added output of lsp-describe-session, note that I managed to get ccls working (out of the box).
    – ideasman42
    Sep 7 '19 at 15:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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