Repository: sublimelsp/LSP

Issue:
Settings for editing inlay hints
**Is your feature request related to a problem? Please describe.**
I wish to style the inlay hints that LSP provides, however, LSP only allows for very limited styling, basically background color, font type, font color, but nothing else. There are these ugly round borders on the little hint that cannot be removed without editing inlay_hint.py directly to change the enforced CSS.

**Describe the solution you'd like**
The ability to either change all CSS values of the inlay hint though variables, or the ability to outright overwrite the css that's currently there from a settings file.

**Describe alternatives you've considered**
Editing LSP with PackageResourceViewer by hand each time there is an update.

**Additional context**
Here is my cute little CSS improvement for my own enjoyment, no more distracting button-like border :<)
![image](https://user-images.githubusercontent.com/7129377/229368756-fc0716f7-652c-414f-9690-824c936a55f1.png)




Discussion:
> or the ability to outright overwrite the css that's currently there from a settings file

In theory you can, and there is a guideline for this in the ST [minihtml docs](https://www.sublimetext.com/docs/minihtml.html#best-practices). So you would [customize](https://www.sublimetext.com/docs/color_schemes.html#customization) the ["phantom_css"](https://www.sublimetext.com/docs/color_schemes.html#phantom_css) setting in your color scheme, and use the `#lsp-inlay-hint` id in the CSS selector to adjust the styles:
https://github.com/sublimelsp/LSP/blob/ea8d2c1328bb01fa69baf9f306613a825b317377/plugin/inlay_hint.py#L102-L117

The bad news is, that it doesn't work, and there seems little incentive from the ST devs to fix it. This statement is based on the missing reactions in a corresponding [issue report](https://github.com/sublimehq/sublime_text/issues/2935) that I filed in 2019.

So I would say this is mostly an upstream issue. The only thing which I think could be improved, would be to move the hardcoded CSS into a new `phantoms.css` file (there exist already files for `popups.css`, `sheets.css`, `notification.css`). Then you could more easily override this file only, without the risk to break the Python code in a future update if you modify `inlay_hint.py` directly.

Resolving patch:
diff --git a/plugin/core/css.py b/plugin/core/css.py
--- a/plugin/core/css.py
+++ b/plugin/core/css.py
@@ -10,6 +10,7 @@ def __init__(self) -> None:
         self.notification_classname = "notification"
         self.sheets = sublime.load_resource("Packages/LSP/sheets.css")
         self.sheets_classname = "lsp_sheet"
+        self.inlay_hints = sublime.load_resource("Packages/LSP/inlay_hints.css")
 
 
 _css = None  # type: Optional[CSS]
diff --git a/plugin/inlay_hint.py b/plugin/inlay_hint.py
--- a/plugin/inlay_hint.py
+++ b/plugin/inlay_hint.py
@@ -1,3 +1,4 @@
+from .core.css import css
 from .core.protocol import InlayHint
 from .core.protocol import InlayHintLabelPart
 from .core.protocol import MarkupContent
@@ -102,18 +103,9 @@ def get_inlay_hint_html(view: sublime.View, inlay_hint: InlayHint, session: Sess
     <body id="lsp-inlay-hint">
         <style>
             .inlay-hint {{
-                color: color(var(--foreground) alpha(0.6));
-                background-color: color(var(--foreground) alpha(0.08));
-                border-radius: 4px;
-                padding: 0.05em 4px;
-                font-size: 0.9em;
                 font-family: {font};
             }}
-
-            .inlay-hint a {{
-                color: color(var(--foreground) alpha(0.6));
-                text-decoration: none;
-            }}
+            {css}
         </style>
         <div class="inlay-hint">
             {label}
@@ -121,6 +113,7 @@ def get_inlay_hint_html(view: sublime.View, inlay_hint: InlayHint, session: Sess
     </body>
     """.format(
         font=font,
+        css=css().inlay_hints,
         label=label
     )
     return html


Test patch: