Closed dsvensson closed 4 years ago
Well I can at least testify for java that it is the same there - it's a game of switching around lines back and forth, to a empty line or another symbol, until at last the width is correct.
In case you haven't realized it, it seems like the box width is calculated after the box has been drawn. So the box width used is the one calculated for the last cursor position. The top-right anchor point is always correctly calculated though.
And the problem is present for all values of lsp-ui-doc-alignment
.
Can confirm this is still an issue, exactly as chrbirks described it. On the first hover, the frame is the wrong size, and uses the correct size of the previously hovered term, but on the second, it's correct. Did some debugging with my basic elisp knowledge (read: debug-on-entry
on set-frame-size
) and saw that the width and height appear to be being set correctly in lsp-ui-doc--move-frame
, so I'm not quite sure what the issue is.
Example of the behaviour:
EDIT: I've done some further digging, and I believe I've located the root cause of this bug. Both the size of the frame and the size of the buffer are dependent on each other. lsp-ui-doc--resize-buffer
calls frame-width
to figure out how wide fill-region
should fill, and lsp-ui-doc--move-frame
calls window-text-pixel-size
to figure out how wide the frame should be. I'm not sure what the best way to fix this is, however.
EDIT 2: A workaround for now is to use Webkit to display documentation by setting lsp-ui-doc-use-webkit
to t
. The frame sizes are correct, but it does require Emacs to be compiled with xwidgets support.
@Sorixelle Is this suppose to be fixed with https://github.com/emacs-lsp/lsp-ui/pull/459? I still see similar issues.
GNU Emacs 29.1 (build 1, x86_64-apple-darwin21.6.0, Carbon Version 165 AppKit 2113.6) of 2023-08-08
Using Golang, but apparently this is the same in other languages. Most often have to jump to an empty line before jumping to a position where I want to show the documentation - otherwise the size of the frame will be too narrow, or too short to show all of the documentation.
Sometimes it's correct width though, and sometimes it's as tall (really tall) as the documentation, and sometimes it's reasonably tall and i can scroll with my wheel to read the long docs, which is fine.
From asking at the official chat, it seems that I'm not the only one with this issue.
Sometimes when the frame has been drawn correctly for a doc string, and when a next shorter doc string is shown, it's like the frame just moves right, so the text is placed correctly, but the frame is just transposed to the new (x,y) upper left corner without changing the size, and thus the right border line of the frame is hidden outside of the right end of the buffer.