Skip to content

Fix resizing logic of the LSP plugin tooltips

Adam Fontenot requested to merge adamfontenot/kate:fix-resize-lsp-tooltip into master

Prior to this commit, the tooltip was resized based on the font metric line height of the text, multiplied by the number of lines. This only works when using a plain text layout, but these tooltips frequently display markdown. This approach also makes the assumption that the text will never be softwrapped, which might be something we want to change in the future.

With this commit, we get the recommended size of the document, which includes the effects of rich text. After adding the document margins, we resize the parent QTextBrowser after setting a maximum size on that widget.

This approach also doesn't require us to get the font metrics for the entire document in order to size it, so it's likely to perform better than the previous approach.

BUG: 492106

Merge request reports