2

When using eldoc with lsp-mode, there are some irritations with the default output.

  • Various characters are backslash escaped, so:

    /* This: isn't so -> "good", you see. */

    Displays as:

    This\: isn\'t so -\> \"good\"\, you see.

  • Blank lines are included so:

/**
 * This is a comment.
 */

Displays as:


This is a comment.

Has a blank lines above and below it.


Is there a convenient way to show eldoc as plain-text with blank lines stripped from the start & end, or does this require writing my own eldoc-message-function ?

Note while formatting for doxygen would be nice too, plain un-escaped text is fine.

  • Try this in your lsp-mode configuration: (setq lsp-eldoc-hook nil) - I have it and I do not have your described behaviour. – Ian Jan 22 at 16:18
  • 1
    All this does for me is make eldoc not work in C/C++ code, you must have some other hook activating it for you. – ideasman42 Jan 22 at 16:30
  • 1
    I suspect this is an issue with lsp-mode getting strings in some format which it isn't properly preparing for display. – ideasman42 Jan 22 at 16:32
  • Yes, I have eldoc mode enabled in cc-mode package configuration. – Ian Jan 22 at 18:04
0

lsp-mode uses markdown-mode for rendering documentation which has issues regarding: see also https://github.com/jrblevin/markdown-mode/issues/409 . If you want to render it in a different way you may modify lsp-language-id-configuration.

| improve this answer | |
  • Can you expand on this? this map just maps the mode to a string, eg: (c-mode . "c") (c++-mode . "cpp") (objc-mode . "objective-c") – ideasman42 Jan 30 at 22:40
  • You should change the "markdown" entry in that map. It handles the markdown rendering. – Ivan Dimitrov Yonchovski Jan 31 at 17:17

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.