Skip to content

Commit

Permalink
Replace Quick-Fix label in hover popup with lightbulb icon
Browse files Browse the repository at this point in the history
  • Loading branch information
jwortmann committed Dec 4, 2024
1 parent 9e30185 commit e304c06
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 3 deletions.
Binary file added icons/lightbulb_colored.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion plugin/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ def on_hover(self, point: int, hover_zone: int) -> None:
def _on_hover_gutter_async(self, point: int) -> None:
content = ''
if self._lightbulb_line == self.view.rowcol(point)[0]:
content += code_actions_content(self._code_actions_for_selection)
content += code_actions_content(self._code_actions_for_selection, lightbulb=False)
if userprefs().show_diagnostics_severity_level:
diagnostics_with_config: list[tuple[ClientConfig, Diagnostic]] = []
diagnostics_by_session_buffer: list[tuple[SessionBufferProtocol, list[Diagnostic]]] = []
Expand Down
6 changes: 4 additions & 2 deletions plugin/hover.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def link(self, point: int, view: sublime.View) -> str:
]


def code_actions_content(actions_by_config: list[CodeActionsByConfigName]) -> str:
def code_actions_content(actions_by_config: list[CodeActionsByConfigName], lightbulb: bool = True) -> str:
formatted = []
for config_name, actions in actions_by_config:
action_count = len(actions)
Expand All @@ -95,8 +95,10 @@ def code_actions_content(actions_by_config: list[CodeActionsByConfigName]) -> st
text = actions[0].get('title', 'code action')
href = "{}:{}".format('code-actions', config_name)
link = make_link(href, text)
lightbulb_html = '<span class="lightbulb"><img src="res://Packages/LSP/icons/lightbulb_colored.png"></span>' \
if lightbulb else ''
formatted.append(
f'<div class="actions">Quick Fix: {link} <span class="color-muted">{config_name}</span></div>')
f'<div class="actions">{lightbulb_html}{link} <span class="color-muted">{config_name}</span></div>')
return "".join(formatted)


Expand Down
3 changes: 3 additions & 0 deletions popups.css
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
color: var(--foreground);
padding: 0.5rem;
}
.actions .lightbulb {
padding-right: 0.3rem;
}
.actions a.icon {
text-decoration: none;
}
Expand Down

0 comments on commit e304c06

Please sign in to comment.