sublimehq / sublime_text

Issue tracker for Sublime Text
https://www.sublimetext.com
800 stars 35 forks source link

Gutter icon priority #1664

Open deathaxe opened 7 years ago

deathaxe commented 7 years ago

In Issue #319 several possible improvements to the gutter area are discussed. Some of them may need heavy code changes to be supported and thus still not done. I don't want to continue the discussion of the locked thread here, but ask for a change which might be possible with little effort.

Sublime Text seems basically able to handle multiple icons at a line. There are many cases where icons are replaced by each other, well. The only question is - who decides which one to show? There seems no algorithm at the moment?

The view.add_regions(key, [regions], <scope>, <icon>, <flags>) uses key to identify the icons added to the gutter area.

How about using key as priority? Regions could be sorted alphabetically by key internally before adding gutter icons. This way a lower prior region A could be overwritten by a region B as it is located after A in the sorted list.

This way packages could use key to define the priority chain. The key could have a name like 010_package_usage then.

Example:

000_git_gutter_event            lowest priority
500_sublime_linter          medium priority
900_brackethighlighter          high priority
pykong commented 6 years ago

This issue should be extended to include text highlight priority. Both text highlight and gutter icon are set by the add_regions command. In both cases, priority conflicts occur. The proposed solution may work for the problem of colliding text highlights as well.