Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow style overrides for inlay_hints.css #2232

Merged
merged 4 commits into from
Apr 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions inlay_hints.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.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;
}

.inlay-hint a {
color: color(var(--foreground) alpha(0.6));
text-decoration: none;
}
1 change: 1 addition & 0 deletions plugin/core/css.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
13 changes: 3 additions & 10 deletions plugin/inlay_hint.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from .core.css import css
from .core.protocol import InlayHint
from .core.protocol import InlayHintLabelPart
from .core.protocol import MarkupContent
Expand Down Expand Up @@ -102,25 +103,17 @@ 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}
</div>
</body>
""".format(
font=font,
css=css().inlay_hints,
label=label
)
return html
Expand Down