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

Use the system font for header elements in popups #1515

Merged
merged 4 commits into from
Dec 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 2 additions & 8 deletions plugin/hover.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def symbol_actions_content(self, point: int) -> str:
if userprefs().show_symbol_action_links:
actions = [lk.link(point, self.view) for lk in link_kinds if self.provider_exists(lk)]
if actions:
return '<p class="actions">' + " | ".join(actions) + "</p>"
return '<div class="actions">' + " | ".join(actions) + "</div>"
return ""

def diagnostics_content(self) -> str:
Expand All @@ -120,21 +120,15 @@ def diagnostics_content(self) -> str:
for diagnostic in self._diagnostics_by_config[config_name]:
by_severity.setdefault(diagnostic.severity, []).append(
format_diagnostic_for_html(diagnostic, self._base_dir))

for severity, items in by_severity.items():
formatted.append("<div>")
for items in by_severity.values():
formatted.extend(items)
formatted.append("</div>")

if config_name in self._actions_by_config:
action_count = len(self._actions_by_config[config_name])
if action_count > 0:
href = "{}:{}".format('code-actions', config_name)
text = "choose code action ({} available)".format(action_count)
formatted.append('<div class="actions">{}</div>'.format(make_link(href, text)))

formatted.append("</div>")

return "".join(formatted)

def hover_content(self) -> str:
Expand Down
29 changes: 12 additions & 17 deletions popups.css
Original file line number Diff line number Diff line change
@@ -1,52 +1,47 @@
.lsp_popup {
margin: 0.5rem 0.5rem 0 0.5rem;
margin: 0.5rem;
font-family: system;
}
.lsp_popup .highlight {
.highlight {
border-width: 0;
border-radius: 0;
}
.lsp_popup p {
.diagnostics {
margin-bottom: 0.5rem;
padding: 0 0.5rem;
font-family: system;
}
.lsp_popup li {
font-family: system;
font-family: monospace;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how to "reset" the font-family here. The value monospace doesn't actually do what it is supposed to do: #1171 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are referring to a deleted line?
Not sure what do you exactly mean since the code doesn't look like that anymore.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote font-family: monospace; here, but that doesn't actually work as you'd expect. It just so happens to work. But the behavior is unconfirmed on Windows.

The only special font-family is presumably system.

}
.lsp_popup .diagnostics {
margin-bottom: 0.5rem;
}
.lsp_popup .errors {
.errors {
border-width: 0;
background-color: color(var(--redish) alpha(0.25));
color: var(--foreground);
padding: 0.5rem;
}
.lsp_popup .warnings {
.warnings {
border-width: 0;
background-color: color(var(--yellowish) alpha(0.25));
color: var(--foreground);
padding: 0.5rem;
}
.lsp_popup .info {
.info {
border-width: 0;
background-color: color(var(--bluish) alpha(0.25));
color: var(--foreground);
padding: 0.5rem;
}
.lsp_popup .hints {
.hints {
border-width: 0;
background-color: color(var(--bluish) alpha(0.25));
color: var(--foreground);
padding: 0.5rem;
}
.lsp_popup .actions {
.actions {
font-family: system;
border-width: 0;
background-color: color(var(--foreground) alpha(0.1));
color: var(--foreground);
padding: 0.5rem;
}
.lsp_popup .actions a.icon {
.actions a.icon {
text-decoration: none;
}
pre.related_info {
Expand Down