ballerina-platform / lsp4intellij

This language client library provides language server protocol support for IntelliJ IDEA and other Jetbrains IDEs.
Apache License 2.0
438 stars 104 forks source link

Improve the hover content rendering #357

Closed ThemiraChathumina closed 5 months ago

ThemiraChathumina commented 5 months ago

Purpose

This PR introduces several styling enhancements to improve the visual display of content in the hover box, addressing the issue described in lsp4intellij#356.

Approach

The content within the hover box is processed as HTML. The following improvements have been applied to the HTML code used for displaying hover content:

  1. Change the font styles in paragraph, code, and header tags.
  2. Add a theme-aware background highlight color to code tags. This color is calculated by inverting the font color and darkening it slightly.
  3. Add horizontal padding to the code tags. Since CSS padding does not function inside the hover box, spaces were manually added at the beginning and end of the content in code tags. Code tags that end with a newline were excluded from this adjustment to avoid creating extra rows in certain scenarios.

Samples

image image

image image