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

[Diff] Scope trailing spaces #3927

Merged
merged 2 commits into from
Feb 18, 2024
Merged

Conversation

deathaxe
Copy link
Collaborator

@deathaxe deathaxe commented Feb 18, 2024

Resolves #1304

This PR...

  1. sets syntax specific setting "draw_white_space": ["trailing_all"] so trailing spaces are rendered by default.
  2. scopes trailing spaces meta.whitespace.trailing in inserted/removed/modified lines, so color schemes can address them and possibly apply background color.

Example:

grafik

Color Scheme Rules

{
	"scope": "markup.changed.diff meta.whitespace",
	"background": "color(var(orange) alpha(0.15))",
},
{
	"scope": "markup.deleted.diff meta.whitespace",
	"background": "color(var(red2) alpha(0.15))",
},
{
	"scope": "markup.inserted.diff meta.whitespace",
	"background": "color(var(green2) alpha(0.15))",
},

This commit scopes trailing spaces `meta.whitespace.trailing`
in inserted/removed/modified lines.
@keith-hall
Copy link
Collaborator

  1. sets syntax specific setting "draw_white_space": ["trailing_all"] so trailing spaces are rendered by default.

Is this additive with the user preferences? If I have my draw white space setting set to all, having this syntax specific setting won't "undo"/hide/override my array, just add to it? Or will it only draw (perhaps selected and) trailing whitespace? (If I were at a computer I'd check it myself...)

@deathaxe
Copy link
Collaborator Author

deathaxe commented Feb 18, 2024

Well, syntax specific settings take precedence over user settings, so "trailing_all" would win in diffs.

EDIT: Maybe better to add scopes, only, as displaying leading spaces may also be desirable.

@deathaxe deathaxe merged commit c275309 into sublimehq:master Feb 18, 2024
2 checks passed
@deathaxe deathaxe deleted the pr/diff/whitespace branch February 18, 2024 18:16
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.

[Diff] Trailing Whitespace should be highlighted somehow
3 participants