emacs-lsp / lsp-ui

UI integrations for lsp-mode
https://emacs-lsp.github.io/lsp-ui
GNU General Public License v3.0
1.03k stars 141 forks source link

[lsp-ui-doc regression] Doc buffer formatting deletes text around horizontal rules #642

Closed Bob131 closed 2 years ago

Bob131 commented 2 years ago

The fill-region introduced by ~1766df5~ deeefa0ce03fdb4927f6ff5195010aef494f9b4c can result in documentation text being placed on the same line as ---; this text is then deleted with the horizontal rule by lsp-ui-doc--handle-hr-lines. Since this change, almost all the lsp-ui-doc popups produced with clangd are empty.

ericdallo commented 2 years ago

c/c @jcs090218

jcs090218 commented 2 years ago

@Bob131 Can you try print the full raw text here? Sorry, I cannot setup [clangd]() on my current machine, so I cannot see what's the document look like. 😕

jcs090218 commented 2 years ago

Would #643 fix the issue?

Bob131 commented 2 years ago

I just tried applying it, and it doesn't address the issue.

Here's a sample of the output from clangd for a random macro in GLib:

### macro `TYPE`  

---
```cpp
#define TYPE(Char)                                                 \\
  (((Char) <= G_UNICODE_LAST_CHAR_PART1)                           \\
       ? TTYPE_PART1 ((Char) >> 8, (Char) &0xff)                   \\
       : (((Char) >= 0xe0000 && (Char) <= G_UNICODE_LAST_CHAR)     \\
              ? TTYPE_PART2 (((Char) -0xe0000) >> 8, (Char) &0xff) \\
              : G_UNICODE_UNASSIGNED))
```

Here is the same sample after applying the previous fill-region code or the new lsp-ui-doc--fill-document:

### macro `TYPE`

--- ```cpp #define TYPE(Char) \\ (((Char) <= G_UNICODE_LAST_CHAR_PART1) \\ ? TTYPE_PART1 ((Char) >> 8, (Char) &0xff) \\ : (((Char) >= 0xe0000 &&
(Char) <= G_UNICODE_LAST_CHAR) \\ ? TTYPE_PART2 (((Char) -0xe0000) >> 8, (Char) &0xff) \\ : G_UNICODE_UNASSIGNED)) ```
jcs090218 commented 2 years ago

I have changed to check the length of the first line in paragraph. I have also tested on my machine, this should be working now.

@Bob131 Can you get the latest version and see if this issue is resolved? Thanks!

Bob131 commented 2 years ago

Yep, that's better. Thanks!