ale should override signs from gitgutter
avishaan opened this issue ยท 19 comments
Ale signs should take precedence over gitgutter, that's also how syntastic and gitgutter work together with syntastic taking precedence. the idea being as I fix my syntax errors, I'll be able to see my gitgutter signs. Especially important because I should be fixing syntax errors before committing code (which would clear the gitgutter signs)
Here is a related discussion on this for gitgutter and syntastic quite some time ago airblade/vim-gitgutter#1
This follows on from #23, one of the earliest issues, where I made it so it doesn't remove gitgutter signs. This might be slightly harder to implement than for Syntastic, as ALE updates signs as you type. If anyone wants to try fixing this, give it a go.
Yup, I noticed that as well. Originally I was using Syntastic which is where I got use to the functionality. I happened to reinstall my dev environment and only now was wondering where the linter went. For now I can disable gitgutter until someone is able to come up with a fix or I move to Syntastic/Neomake.
@w0rp is it something that may not be possible with Ale? Helpful to know for deciding how long I should wait to switch over. Is there a priority level for what displays in the sign column?
I reckon it should be possible. Someone just needs to go ahead and do it.
@w0rp do you have a bounty bot you use, I wouldn't mind attaching a couple bucks to this issue
I'm wrong, my issue was because I was using emoji for the gutter for ale and I see there is another issue here #511 that references a problem with tmux 2.4. In order to get both my gitgutter and ale signs to display, I changed the ale sign to simple characters and now everything looks ok
Cool. ๐
I still have this issue when using the default ">>" and "--" ASCII sign characters for ale. Same thing if they're single characters, e.g. ">" and "-". gitgutter overrides ale, but I definitely want errors to take priority over git status.
My workaround is to have ale show the location list on error, but I'd prefer the sign characters alone with the ability to open the location list when needed.
I'm using vim 8.0.1415, ale 1568bf8, and vim-gitgutter 1e60667322, all the latest as of now, and no tmux.
As far as I can tell, whichever sign is set last wins. If vim-gitgutter sets signs after ALE, the signs will cover ALE's signs. Someone might have to change vim-gitgutter
so it doesn't cover existing signs.
Unsure if this is the same issue or a different one. If not I'll happily move this to another issue.
If I use the default >>
and --
I see two columns of signs both with a yellow background. By setting them to single characters >
and -
I expected only one column to be shown. However 2 are still visible, the second being just the yellow background with a single space (>
or -
). I checked the source but didn't find any obvious way to customise this. Is this something that can be corrected or even adjusted automatically depending on the length of ale_sign_error
and ale_sign_warning
?
The sign column is fixed to two characters in size in Vim, and cannot be changed.
Thanks for the clarification.
Not sure how this was working with syntactic+gitgutter, maybe luck? The problem of sign conflicts between plugins is known from some time already and there is an issue discussion to improve the signs API (e.g. add priorities) in Neovim: neovim/neovim#8668
In Neovim (and possibly in Vim, haven't looked at source), what currently determines the displayed sign, is the rather random order of link list of signs, order that is determined by the order of insertion. The one that appears first in the list is displayed.
I am working on a discussed change in Neovim where multiple sign column are displayed: neovim/neovim#9295, and among it was agreed to sort by sign Id, so that more than one of them are displayed and the order is deterministic.
Still in RFC stage.
With #2786 it is possible to set g:ale_sign_priority to a value higher than 10 to ensure ALE signs take precedence over other plugins. Also this PR adds support for sign groups that ensure ALE sign manipulations do not interfere with other plugins signs.
Notes:
- Only works for NeoVim 0.4.0 and Vim 8.1.0614 and latter.
- Other plugins may also support sign-priority. Ensure you set g:ale_sign_priority to your needs.
gitgutter does not use priority therefore any value larger than 10 ensures ALE will take
precedence over it.
@hsanson
I'm using VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Jan 8 2020 00:57:57)
But It seems "sign-priority" not working..
I have added 2 lines to .vimrc:
let g:gitgutter_sign_priority = 10
let g:ale_sign_priority = 11
But gitgutter's signs always show, that overrode ale's signs
I do not use gitgutter so cannot debug this. Please list the signs in your current buffer and ensure both ALE and Gitgutter are setting the signs priority correctly:
:sign place group=* buffer=bufnr('%')
You will see a list like below:
app/controllers/api_controller.rb ใฎใตใคใณ:
line=1 id=1000001 group=ale name=ALEWarningSign priority=30
line=7 id=1000002 group=ale name=ALEWarningSign priority=30
line=9 id=1000003 group=ale name=ALEWarningSign priority=30
line=10 id=1000004 group=ale name=ALEWarningSign priority=30
line=14 id=1000005 group=ale name=ALEWarningSign priority=30
line=16 id=1000006 group=ale name=ALEWarningSign priority=30
line=17 id=1000007 group=ale name=ALEWarningSign priority=30
line=20 id=1000008 group=ale name=ALEWarningSign priority=30
line=21 id=1000009 group=ale name=ALEWarningSign priority=30
line=24 id=1000010 group=ale name=ALEWarningSign priority=30
line=25 id=1000011 group=ale name=ALEWarningSign priority=30
line=27 id=1000012 group=ale name=ALEWarningSign priority=30
line=31 id=1000013 group=ale name=ALEWarningSign priority=30
line=43 id=1000014 group=ale name=ALEWarningSign priority=30
line=52 id=1000015 group=ale name=ALEWarningSign priority=30
line=56 id=1000016 group=ale name=ALEWarningSign priority=30
line=57 id=1000017 group=ale name=ALEWarningSign priority=30
line=60 id=1000018 group=ale name=ALEWarningSign priority=30
line=64 id=1000019 group=ale name=ALEWarningSign priority=30
line=66 id=1000020 group=ale name=ALEWarningSign priority=30
line=68 id=1000021 group=ale name=ALEWarningSign priority=30
line=76 id=1000022 group=ale name=ALEWarningSign priority=30
line=79 id=1000023 group=ale name=ALEWarningSign priority=30
line=80 id=1000024 group=ale name=ALEWarningSign priority=30
line=84 id=1000025 group=ale name=ALEWarningSign priority=30
line=85 id=1000026 group=ale name=ALEWarningSign priority=30
line=86 id=1000027 group=ale name=ALEWarningSign priority=30
line=88 id=1000028 group=ale name=ALEWarningSign priority=30
line=89 id=1000029 group=ale name=ALEWarningSign priority=30
You can further play setting signs by yourself to see if priorities work as expected:
:sign place 890001 group=test priority=40 line=2 name=ALEErrorSign buffer=bufnr('%')
Hopefully this information can help you debug the issue.
Hi all,
in my case with latest macvim and ale the issue is still present and
a possible workaround to obtain the correct behavior is to set the gitgutter priority
to a value less than 10.
Indeed, if in my .vimrc I set
let g:ale_sign_priority=30
let g:gitgutter_sign_priority=10
which are the default values, I get gitgutter sign rendered on top of ale sign, i.e. as if
it has higher priority than ale sign.
Anyway if I set:
let g:ale_sign_priority=30
let g:gitgutter_sign_priority=9
i.e. a value less than 10 for gitgutter sign (where 10 is the default value assigned to signs by vim), the ale sign is correctly rendered with higher priority.
I suspect that ale_sign_priority is not handled correctly, i.e. the priority of ale signs is always set to the default value (i.e. 10). To support this conclusion, if set
let g:ale_sign_priority=8
let g:gitgutter_sign_priority=9
ale still has higher priority than gitgutter sign, being rendered on top of gitgutter sign.
In conclusion, it seems that ale signs are always rendered as if they have a priority equal to 10.
followup
To confirm my guess by issuing the command
:sign place group=* buffer=bufnr('%')
I get:
line=285 id=1 group=gitgutter name=GitGutterLineModified priority=9
line=378 id=1000001 name=ALEWarningSign priority=10
line=381 id=1000002 name=ALEWarningSign priority=10
line=417 id=1000003 name=ALEWarningSign priority=10
line=421 id=1000004 name=ALEWarningSign priority=10
line=570 id=2 group=gitgutter name=GitGutterLineModified priority=9
line=601 id=1000020 name=ALEWarningSign priority=10
line=602 id=1000021 name=ALEWarningSign priority=10
line=628 id=3 group=gitgutter name=GitGutterLineModified priority=9
line=730 id=1000022 name=ALEWarningSign priority=10
line=731 id=1000023 name=ALEWarningSign priority=10
line=927 id=1000005 name=ALEWarningSign priority=10
line=931 id=1000006 name=ALEWarningSign priority=10
line=1036 id=4 group=gitgutter name=GitGutterLineModified priority=9
line=1059 id=5 group=gitgutter name=GitGutterLineModified priority=9
line=1367 id=1000024 name=ALEWarningSign priority=10
line=1814 id=6 group=gitgutter name=GitGutterLineModified priority=9
Greetings,
I ran into the same issue with Syntastic, where gitgutter would get a higher priority in the sign column. The above fix of setting the following in the .vimrc seemed to fix this:
let g:syntastic_sign_priority=30
let g:gitgutter_sign_priority=9
Just wanted to mention this here in case anyone else runs into the problem. Thanks for finding this :)