Skip to content

Commit

Permalink
cmd/govim: fix GOVIMQuickfixDiagnostics command (#662)
Browse files Browse the repository at this point in the history
Per #657, after 2975a8f `:GOVIMQuickfixDiagnostics` is broken as long as
QuickfixAutoDiagnostics is disabled. This was an unintentional break. We
managed to break this command because the command was not actually
tested.

Fix both of these points by fixing the bug itself and also adding a test
to prevent further breakage.

Fixes #657
  • Loading branch information
myitcv committed Jan 8, 2020
1 parent acb0572 commit c4bb087
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/govim/quickfix.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func (v *vimstate) quickfixDiagnostics(flags govim.CommandFlags, args ...string)
}

func (v *vimstate) updateQuickfix(diags []types.Diagnostic, force bool) error {
if v.config.QuickfixAutoDiagnostics == nil || !*v.config.QuickfixAutoDiagnostics {
if !force && (v.config.QuickfixAutoDiagnostics == nil || !*v.config.QuickfixAutoDiagnostics) {
return nil
}
v.diagnosticsChangedLock.Lock()
Expand Down
16 changes: 16 additions & 0 deletions cmd/govim/testdata/scenario_default/quickfix_config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ cmp errors empty
vim -indent expr 'sign_getplaced(\"main.go\", {\"group\": \"*\"})'
cmp stdout signs.golden3

# Calling :GOVIMQuickfixDiagnostics should force-populate the quickfix window
vim ex 'GOVIMQuickfixDiagnostics'
vim ex 'copen'
vim ex 'w errors'
vim ex 'cclose'
cmp errors errors.golden3

# Disabled pending resolution to https://github.com/golang/go/issues/34103
# errlogmatch -start -count=0 'LogMessage callback: &protocol\.LogMessageParams\{Type:(1|2), Message:".*'

Expand Down Expand Up @@ -239,6 +246,15 @@ main.go|11 col 19| missing return
]
}
]
-- errors.golden3 --
main.go|6 col 36| undeclared name: i
main.go|6 col 39| undeclared name: v
main.go|7 col 35| undeclared name: i
main.go|7 col 38| undeclared name: v
main.go|8 col 35| undeclared name: i
main.go|8 col 38| undeclared name: v
main.go|11 col 19| missing return
main.go|12 col 19| missing return
-- nosigns.golden --
[
{
Expand Down

0 comments on commit c4bb087

Please sign in to comment.