Skip to content

Use scheme color for lightbulb icon in popup#2807

Merged
jwortmann merged 1 commit intosublimelsp:mainfrom
jwortmann:lightbulb-color
Mar 15, 2026
Merged

Use scheme color for lightbulb icon in popup#2807
jwortmann merged 1 commit intosublimelsp:mainfrom
jwortmann:lightbulb-color

Conversation

@jwortmann
Copy link
Copy Markdown
Member

@jwortmann jwortmann commented Mar 13, 2026

Previously I used the orange color from the Mariana color scheme for the lightbulb icon for code actions in the hover popup. This means that the color isn't accurate for other color schemes and in that case doesn't match the color from the lightbulb gutter icon.

We can actually use a mdpopups function to dynamically tint the icon, based on the color scheme. This requires the newest version of mdpopups (v4.3.5 for Py3.8 or v5.1.1 for Py3.13). You can run Package Control: Satisfy Libraries to force an update if you still have a previous version.


Example with Monokai:

Before:

before

After:

after

If we decide to place the code action directly into the diagnostic box (see #2788 (comment), perhaps I will look into that later) we could probably remove the lightbulb icon in the hover popup. But for now we could fix the icon color.

Comment thread plugin/hover.py
formatted.append(
f'<div class="actions">{lightbulb_html}{link} <span class="color-muted">{config_name}</span></div>')
f'''
<div class="code-actions">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's a single code action so code-action class might be more appropriate.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

In the example from the screenshot yes, but if there are multiple actions it shows as "choose (3 available)" on a single line, which triggers the quick panel in that case.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

If you agree to refactor displaying the code actions as part of the diagnostic boxes directly (like the relatedInformation), then I think we could show all available code actions separately and reconsider the CSS class name, if it's still needed then.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Have not given that change a lot of thought.
I wonder if it would then look inconsistent when code action doesn't have related diagnostic (in case of manually triggering "source actions" for example).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We only show "quickfix" code actions in the popup, and I think in theory all quickfix actions should have a corresponding diagnostic.

When manually triggered from the context menu, they are shown in the quick panel.

@jwortmann jwortmann merged commit 8414e27 into sublimelsp:main Mar 15, 2026
14 of 20 checks passed
@jwortmann jwortmann deleted the lightbulb-color branch March 15, 2026 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants