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
Icons in custom gutter theme #1125
Comments
This part should enable you to use custom icons, but I think you need to put in the path to the icons and not just the name. So, the theme in this case only tells it to colorise or not, but isn't used as a starting point to finding the icon files.
Let me know if putting the full path in the "icon" setting works for you. |
Very busy also. PR's very welcome indeed. |
In addition, some enhanced documentation for end users would be welcome. I've been spending to much time trying to get gutter icons to work and still have no clue how gutter themes in SL4 can be activated. I tried various combinations that I thought could make sense after reading the docs and the default settings file, until I settled for the one below (– using only directly linked icons).
Could you shed some light on how one is supposed to do it? Also, I guess the default folder for users who create gutter themes should also be in the documentation, too. Maybe |
Hello, everybody. What follows is slightly off-topic to what this issue is all about, but it should be taken into account if the code mentioned in the first message is modified so the gutter themes might work in a different way. @pattulus: The default SublimeLinter settings file explains exactly how the gutter themes work: // - icon can be:
// one of the default icons: "circle", "dot" or "bookmark"
// or a path to an icon file like (e.g. "Packages/icons/warning.png")
// or "none" to remove the icon
// or one provided by a gutter theme (e.g. "warning" or "error")
// in theme Default: "warning", "error", "cog", "x",
// and "diamond", "heart", "pointer", "square", "star", "triangle" all
// also have an -outline variant. Example: {
"gutter_theme": "Default",
"styles": [{
"mark_style": "outline",
"priority": 1,
"scope": "sublimelinter.mark.warning",
"icon": "triangle",
"types": [
"warning"
]
}, {
"mark_style": "outline",
"priority": 1,
"scope": "sublimelinter.mark.error",
"icon": "x",
"types": [
"error"
]
}]
}
If the gutter theme used has the |
Still having trouble understanding all this stuff, but @Odyseus settings got me back to where I want to be. Thank you! Hopefully will help others... |
@Odyseus The explanations in the default SublimeLinter settings file worked for me, too, in the end. Although, they are "exact" like you said, I would wish them to be a tad more elaborate. Obviously, I tried to hard yesterday because I had something alike your example, but added the file extension to the icon name (and yes, this is exactly like the settings tell you to do it). Maybe I was confused because even the relative and absolute paths I tried failed. I don't know. Just glad it works now and knowing how to do it properly. Thanks. |
See, I’m not that lazy 😎 |
@braver Thanks, I've tested your code. It could be even simpler and user-friendly. What do you think of this? elif persist.settings.get('gutter_theme').endswith('.gutter-theme'):
theme_path = 'Packages/SublimeLinter/gutter-themes/Default'
files = sublime.find_resources(persist.settings.get('gutter_theme'))
if files:
theme_path = os.path.dirname(files[0])
if not res.endswith('.png'):
res += '.png'
return '{}/{}'.format(theme_path, res) So If you have a If you have a |
@Monokai using At some point the user will have to know what to put in the Also, minor other point, you're proving a fallback to the Default theme if the user mucks up his setting by entering something that doesn't exist. My approach here is for it to visually fail instead, again to take out the guesswork. So, yeah, it can perhaps be more friendly with even more effort, but I think the PR covers the feature request well enough? |
@braver Yes, it's a guessing game, maybe you're right. I thought you could work with paths, but if not, then it's indeed not a better solution. I would say just do your original thing! |
Yeah, I kinda hoped for that too, but alas. Thanks for thinking along with us though! |
fix #1125 Friendly configuration for icons
I've created custom gutter themes for https://www.monokai.pro and they worked well for SL3.
In SL4, it seems custom error / warning icons are gone, while it does pick up the right
colorize
value from thegutter-theme
file. Looking through your code, I think this is the part where custom icons are resolved:I think this part
'Packages/SublimeLinter/gutter-themes/{}/{}.png'.format(theme, res)
shouldn't be hardcoded, but the base folder should be the same folder as where thegutter-theme
file is found (if defined via thegutter_theme
setting).The text was updated successfully, but these errors were encountered: