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.

ideasman42
  • 8,375
  • 1
  • 28
  • 105
  • 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 '20 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 '20 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 '20 at 16:32
  • Yes, I have eldoc mode enabled in cc-mode package configuration. – Ian Jan 22 '20 at 18:04

1 Answers1

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.

  • 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 '20 at 22:40
  • You should change the "markdown" entry in that map. It handles the markdown rendering. – Ivan Dimitrov Yonchovski Jan 31 '20 at 17:17
  • I've removed this entry but the documentation renders the same as before. `(setq lsp-language-id-configuration (assq-delete-all 'lsp--render-markdown lsp-language-id-configuration)) (setq lsp-language-id-configuration (assq-delete-all 'markdown-mode lsp-language-id-configuration))` – ideasman42 Nov 09 '21 at 02:30