Skip to content

Commit

Permalink
Use the system font for header elements in popups (#1515)
Browse files Browse the repository at this point in the history
- Compactify
- Compactify more
- Remove extraneous <div>, and use <div> for actions instead of <p>
  • Loading branch information
rwols authored Dec 7, 2020
1 parent 5ad0ba3 commit d772f93
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 25 deletions.
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;
}
.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

0 comments on commit d772f93

Please sign in to comment.