-
Notifications
You must be signed in to change notification settings - Fork 184
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 regular font style in sighelp popup if already highlighted by color scheme #2259
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that is expected. An alternative to the bold & underline font style by default, would be to use a different scope for the active parameter color. But that would probably also complicate things, because you can't really be sure that it creates a sufficient contrast to the color for non-active parameters. |
Should we also add those rules to the https://github.com/sublimelsp/LSP/tree/main/ColorSchemes? I noticed that I can spot the active parameter easier when the color is different from the inactive parameter.
|
Has this change taken away the ability for someone to use custom sighelp colours and have bolding/underlining behaviour? |
Yes |
Yes, this was the point of the change. If you had the custom sighelp colors before, the bold font style used to make the color appear a bit brighter (on dark color schemes), in comparison to regular font style. So if you prefer to keep a similar contrast as before, you might need to update your custom colors now. Now that I think about it, we could in theory add an unused CSS class to the tag in that case, like this: - '; font-weight: bold; text-decoration: underline' if emphasize else '',
+ '; font-weight: bold; text-decoration: underline' if emphasize else '" class="active-parameter', Then it would be the same default as it is now, but users could re-add the bold/underline via In regard to shipping with custom rules for the default color schemes, we could do that, but then I would do it for all 5 color schemes, and I would also drop the |
Thank you. To me, It's not all about contrast. The underline in particular made it very easy to pick out the active parameter at a glance.
Maybe I'm misunderstanding the relative importance of the HTML/CSS aspect, but wouldn't it be more correct to delegate the bold/underline decision to the Colour Scheme? i.e. a rule could be: {"scope": "variable.parameter.sighelp.active.lsp", "foreground": "var(green)", "font_style": "bold underline"} and that desire for |
Actually not a bad idea. I think it would work, but we need to apply a little "trick" which is already used for the diagnostics |
The "trick" that I had in mind was actually used for the semantic tokens, and not for diagnostic tags. Line 679 in a6edba3
I tried to implement using the font style from the color scheme for the active parameter, but there seems to be a bug in the style_for_scope API method, which makes parts of the results unreliable. In particular it doesn't seem to work correctly for the variable.parameter.sighelp.active.lsp scope when I tested it with my own color scheme. I filed a report on the ST issue tracker at sublimehq/sublime_text#5983.
Unfortunately this probably means that we're stuck here in regard to implementing such a solution, unless someone has another idea how to retain the bold & underline if there is no color scheme rule for the scope. Alternatively we could use the approach of the CSS class for now. |
Thanks for trying it. Let's see if that issue possibly gets a quick fix. |
* main: fix "Error rewriting command" warning triggered on startup (#2277) Take font style of sighelp active parameter from color scheme (#2279) Add argument "include_declaration" to "lsp_symbol_references" (#2275) fix crash on checking excluded folders with missing project data (#2276) Fix tagged diagnostics flickering on document changes (#2274) Cut 1.24.0 use class for diagnostic info instead of hardcoding color (#2257) Fix package storage path in a docstring description (#2256) Use regular font style in sighelp popup if already highlighted by color scheme (#2259) update note about custom color scheme rule used for diagnostics (#2254)
The signature help popup uses bold & underlined font style for the active parameter, which looks a bit ugly in my opinion.
With this PR, it will keep the regular font style if the color scheme already defines different colors for active and non-active parameters. This is the case for example in my own color scheme, (though I will probably adjust the colors a bit if the PR gets merged).
Also the number of
View.style_for_scope
API calls is reduced by storing the results into variables and avoiding redundant calls.