Hello guys, my question is basically in the title. I would really like to be able to have the parameter names included when I cursor over a function and open the ‘hover’ window to show basic info about it. Currently it only shows me the expected types, which while still useful I feel is only a piece of the puzzle when working either with a new library, or a codebase you’re not familiar with.

As an example I’m learning ncurses these past couple days, and its significantly flow-breaking to have to switch focus away from the editor to either search on the web what a particular function takes as parameters, or open a separate terminal to read the man page for it. I’m still not familiar with the library so I frequently need to look up what a parameter represents in the context of the code, in addition to what type I should give it. Is there any way to do this while still using clangd as my lsp server?

Ive also included a screenshot of one such hover window for the ncurses function mvprintw.

  • Oscar
    link
    fedilink
    English
    arrow-up
    3
    ·
    3 months ago

    Mine looks like this:

    So it should be possible, at least for the parameters.

    For reference, here's my active LSP config (from :LspInfo):
    - clangd (id: 3)
      - Version: clangd version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) linux+grpc x86_64-unknown-linux-gnu
      - Root directory: ~/repos/traffic-generator
      - Command: { "clangd", "--clang-tidy", "--enable-config", "--compile-commands-dir=build" }
      - Settings: {}
      - Attached buffers: 134
    
    And my .clangd:
    ---
    Diagnostics:
        UnusedIncludes: Strict
        MissingIncludes: Strict
        ClangTidy:
          FastCheckFilter: None
          Add:
            - bugprone-*
            - cert-*
            - clang-analyzer-*
            - clang-diagnostic-*
            - concurrency-*
            - misc-*
            - modernize-*
            - performance-*
            - portability-*
            - readability-*
          Remove:
            # - readability-redundant-member-init
            - bugprone-easily-swappable-parameters
            - readability-identifier-length
            # - readability-function-cognitive-complexity
    
    CompileFlags:
      Add: [-xc]
      Remove: [-fanalyzer]
    
    Completion:
      AllScopes: true
    
    InlayHints:
        Enabled: No
    
    SemanticTokens:
      DisabledKinds: []
      DisabledModifiers: []
    ...