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

Support for gutterSettings #469

Closed
timhillgit opened this issue Apr 9, 2023 · 3 comments · Fixed by #506
Closed

Support for gutterSettings #469

timhillgit opened this issue Apr 9, 2023 · 3 comments · Fixed by #506

Comments

@timhillgit
Copy link
Contributor

syntect currently reads from gutter and gutterForeground when loading themes:

"gutter" => settings.gutter = Color::parse_settings(value).ok(),
"gutterForeground" => {
settings.gutter_foreground = Color::parse_settings(value).ok()
}

But many themes instead store their gutter settings in a gutterSettings key. See for instance the base16 themes at https://github.com/chriskempson/base16-textmate/tree/master/Themes . gutterSettings seems to be more popular than gutterForeground. A GitHub search for themes with gutterSettings returns 3k hits while a search for gutterForeground returns 1.5k. Adding this would probably solve #315

@timhillgit
Copy link
Contributor Author

timhillgit commented Nov 27, 2023

I'm extremely new to Rust but I think something like the following should work:

if let Some(Settings::Object(obj)) = obj.remove("gutterSettings") {
for (key, value) in obj {
match &key[..] {
"background" => settings.gutter = Color::parse_settings(value).ok(),
"foreground" => settings.gutter_foreground = Color::parse_settings(value).ok(),
_ => (),
}
}
}
. Happy to open up a PR if something like this would be accepted

@keith-hall
Copy link
Collaborator

Just to note that implementing this would mean syntect will do something that Sublime Text doesn't. The ST docs only reference gutter and gutterForeground and nothing about gutterSettings: http://www.sublimetext.com/docs/color_schemes_tmtheme.html#global_settings

@timhillgit
Copy link
Contributor Author

Ahh, that's a good catch. It looks like this is one of the few areas where the TextMate 2 format diverges from Sublime Text. So at the very least I don't think we'd want gutterSettings to take priority over gutter and gutterForeground. I'll see if there's a good way to have gutterSettings act as a backup.

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 a pull request may close this issue.

2 participants