-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
check group in when toggling same ids #1538
Conversation
Thank you for the contribution.
|
@bhcleek you are correct about that. However, (see PR description :P) |
I see. In that case, instead of repeating the logic for iterating through the matches, |
That sounds like a better approach. Thank you. I'll do that. |
so we don't need to replicate its group check logic inside ToogleSameIds
Returned a positive value for success and zero for the other case, but I can change that to return a negative value if it would make things better. (Not knowing much vimscript, it just seemed nicer.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please invert the return value; conventionally 0 is success, and non-zero is failure. Since go#guru#ClearSameIds
is supposed to delete any goSameId
groups, failure should mean that none were removed.
autoload/go/guru.vim
Outdated
let m = getmatches() | ||
for item in m | ||
if item['group'] == 'goSameId' | ||
call matchdelete(item['id']) | ||
let l:cleared = 1 | ||
endif | ||
endfor | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If no matches were in the goSameId
group, then return early here so that the BufWinEnter
events won't be removed.
Thank you! |
Thank you for contributing. I squashed your commits and merged them into master. |
Currently,
ToggleSameIds
doesn't check the group of the match and, as I set up vim to highlight characters that go beyond column 80 (just find it a mostly helpful heuristic), when I open a file that contains longer lines,ToggleSameIds
always try to clear highlighted ids, becausegetmatches()
return all highlights and not just theGoSameId
ones.So, as already done in
ClearSameIds
, I think we should also test the group here.