-
-
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
separate gometalinter error list use cases #1652
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1652 +/- ##
==========================================
+ Coverage 21.73% 22.01% +0.27%
==========================================
Files 53 53
Lines 4173 4179 +6
==========================================
+ Hits 907 920 +13
+ Misses 3266 3259 -7
Continue to review full report at Codecov.
|
gometalinter is used in two distinct cases. When run using :GoMetaLinter, all of its output is used. When run automatically on save (e.g. g:go_metalinter_autosave=1), only its output that applies to the current buffer is used. In that case, it makes sense to show its messages in the location list without forcing the user to also use the location list when the user executes :GoMetaLinter. Therefore, add a new key to g:go_list_type_commands, GoMetaLinterAutoSave, with a default value of locationlist and modify go#lint#Gometa to distinguish between the two cases. Fixes fatih#1644
0e6f51b
to
4b146cb
Compare
"quickfix" and "locationlist". | ||
"GoMetaLinter", "GoMetaLinterAutoSave", "GoModifyTags" (used for both | ||
:GoAddTags and :GoRemoveTags), "GoRename", "GoRun", and "GoTest". Supported | ||
values for each command are "quickfix" and "locationlist". |
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.
Can you also update the doc for g:go_metalinter_autosave
setting and :GoMetaLinterAutoSaveToggle
command to add a notice that locationlist
is used instead of quickfix
. These two:
*'g:go_metalinter_autosave'*
Use this option to auto |:GoMetaLinter| on save. Only linter messages for
the active buffer will be shown. By default it's disabled >
let g:go_metalinter_autosave = 0
<
and
*:GoMetaLinterAutoSaveToggle*
:GoMetaLinterAutoSaveToggle
Toggles |'g:go_metalinter_autosave'|.
It's worth adding this because for example I use quickfix
for everything and have custom mappings to select next/previous items from the list. So people should be aware of the side effects.
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.
done
let start = reltime() | ||
while len(actual) == 0 && reltimefloat(reltime(start)) < 10 | ||
sleep 100m | ||
let actual = getqflist() | ||
let actual = getloclist(l:winnr) |
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.
These commands should be not removed, instead it should be based on go#list#Type("GoMetaLinterAutoSave")
and act accordingly, whether it's a location list or quickfix list.
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.
This test is only about the autosave case, and it only tests with the default list type GoMetaLinterAutoSave
. Why would it check the list type before clearing the list?
let winnr = winnr() | ||
|
||
" clear the location lists | ||
call setloclist(l:winnr, [], 'r') |
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.
Same here. We should have a switch and call setqflist()
or setloclist()
based go#list#Type("GoMetaLinterAutoSave")
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.
same comment as above
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.
PTAL
gometalinter is used in two distinct cases. When run using
:GoMetaLinter, all of its output is used. When run automatically on save
(e.g. g:go_metalinter_autosave=1), only its output that applies to the
current buffer is used. In that case, it makes sense to show its
messages in the location list without forcing the user to also use the
location list when the user executes :GoMetaLinter.
Therefore, add a new key to g:go_list_type_commands,
GoMetaLinterAutoSave, with a default value of locationlist and modify
go#lint#Gometa to distinguish between the two cases.
Fixes #1644