GitGutter icon indicating copy to clipboard operation
GitGutter copied to clipboard

GitGutter hides SublimeLinter gutter marks

Open jeroentbt opened this issue 13 years ago • 98 comments

As it stands now, the GitGutter gutter marks hide the SublimeLinter gutter marks. I would say that lint errors should take precedence here. Maybe you guys can work something out?

SublimeLinter issue #554

jeroentbt avatar Sep 17 '13 19:09 jeroentbt

:+1:

Xiphe avatar Sep 17 '13 22:09 Xiphe

+1 same bug

hd-deman avatar Oct 25 '13 13:10 hd-deman

A possible fix for this:

  • You can get a list of named regions like so: view.get_regions("git_gutter_inserted")
  • You can see if a region intersects another region like so: region_a.intersects(region_b)
  • GitGutter uses a single point (1 char long) region for each icon, but they are grouped by the region key (e.g. git_gutter_inserted)
  • GitGutter adds regions in the bind_icons method

So you could maintain a list (via settings) of regions you do not want GitGutter to overwrite, then check if any of the icons will intersect those regions, and if so, skip it.

something like:

def is_region_protected(self, region):
    protected_regions = ["some_region", "some_other_region"] # should be loaded via settings
    protected_region_sets = [self.view.get_regions(r) for r in protected_regions]
    for regions in protected_region_sets:
        for r in regions:
            if r.intersects(region):
                return True

    return False

...

# inside bind_icons method
unprotected_regions = [region for region in regions if not self.is_region_protected(region)]
self.view.add_regions('git_gutter_%s' % event, unprotected_regions, scope, icon)

This however would probably be very inefficient, especially with large lists of protected regions. This should however, give anyone interested in this problem a point in the right direction of how to solve it.

It's not currently high on my list of priorities, but who knows, if I get some free time, I may take a stab at it.

jisaacks avatar Oct 29 '13 02:10 jisaacks

I am not a regular SublimeLinter user, I cannot reproduce this issue.

When I make a change, the GitGutter markers show up almost instantly. Then the SublimeLinter markers show up about a second or two afterwards and coverup any of the conflicting GitGutter markers.

In the screen shot below both lines 2 & 3 have been modified, line 3 is not showing the modified icon, but instead the SublimeLinter illegal icon: screen shot 2013-11-02 at 10 18 24 pm

Can someone describe how to reproduce the issue?

jisaacks avatar Nov 03 '13 02:11 jisaacks

seems to be fixed for me, too - can't reproduce anymore.

Xiphe avatar Nov 04 '13 14:11 Xiphe

Same here, looks like it's working now... Did not update anything either. Ghost in the machine?

Everyone ok with closing this issue?

https://github.com/SublimeLinter/SublimeLinter/issues/554

jeroentbt avatar Nov 05 '13 23:11 jeroentbt

OK, well if no one is having this issue anymore I am going to close this.

jisaacks avatar Feb 03 '14 01:02 jisaacks

I'm having this issue today. Fresh install of ST3 and both SublimeLinter and GitGutter via Package Control. If I remove GitGutter I can see the errors, but if I reinstall it the diffs override the errors.

Not installed: screenshot 2014-03-05 10 03 51

Installed: screenshot 2014-03-05 10 03 21

Twipped avatar Mar 05 '14 18:03 Twipped

I am facing the same problem. one possible solution would be to have a shortcut key through which I could just toggle the annotations.

tusharmath avatar Apr 07 '14 11:04 tusharmath

I am having the same problem. I personally love GitGutter, but it's so hard to use GitGutter and SublimeLinter at same time for this reason.

jesseleite avatar Apr 14 '14 13:04 jesseleite

I have been having this problem for a few months. It ceased for a day or two when I edited the GitGutter preferences, but came back shortly after.

Using ST3

Looks like it would be worth re-opining this..

thedamon avatar Apr 16 '14 13:04 thedamon

I should mention that I have disabled Sublime Linter in favour of GitGutter, because I rely on GitGutter more times a day than I need Sublime Linter :) That said, if a solution was possible, whether it be on GitGutter's end or Linter's end, I would LOVE to have both enabled.

Ultimately, I think if SublimeLinter finds an error, it should take precedence over GitGutter. That would be best of both worlds for me.

jesseleite avatar Apr 16 '14 14:04 jesseleite

Totally. If you're comparing against your main repo (as I do), SublimeLinter isn't ever going to show anything unless the error was actually committed which makes the gutter marks only useful on untracked files

thedamon avatar Apr 16 '14 14:04 thedamon

For anyone having an issue, please take a look at the protected-regions branch. I adds a setting where you can set protected regions that git gutter will not override. You will need to check which region names sublime linter uses and set them as protected for git gutter to not override them.

Please try using that branch report pack any issues and if it helped.

jisaacks avatar Apr 16 '14 14:04 jisaacks

Interesting. I am not familiar enough with SublimeLinter to know what needs to be put into that setting's array... anyone have advice?

jesseleite avatar Apr 17 '14 14:04 jesseleite

@JerseyMilker a quick perusal of that packages code I found the erase_lint_marks method. So it looks like they may just be:

  • lint-underline-illegal
  • lint-underline-violation
  • lint-underline-warning
  • lint-outlines-illegal
  • lint-outlines-violation
  • lint-outlines-warning
  • lint-annotations

jisaacks avatar Apr 17 '14 14:04 jisaacks

GitGutter also hides SublimeXDebug icons (a very popular sublime package for those who work with PHP), which is very annoying.

A simple workaround would be to have a quick way of enabling/disabling GitGutter (Does this exist already?). That way I could, at least, disable GitGutter when using XDebug and re-enable it once I stop debugging.

tgirardi avatar Apr 29 '14 16:04 tgirardi

@tgirardi is there something wrong with just using Package Control: Disable Package when you are debugging and then using Package Control: Enable Package when you are finished?

jisaacks avatar Apr 29 '14 17:04 jisaacks

Yes, it needs a restart.

tgirardi avatar Apr 29 '14 17:04 tgirardi

@tgirardi I just checked, it seems it doesn't exactly require a restart, it stops git gutter from adding any new marks, but does not remove the current ones. Either way, it's not very convenient for you.

I think that is a valid feature request and worthy of it's own ticket. Feel free to open a new issue and reference this one.

I am not sure what the best solution is, and I am open to suggestions, but I agree - some sort of functionality would be useful.

jisaacks avatar Apr 29 '14 19:04 jisaacks