Skip to content

Commit 0d72ef5

Browse files
committed
ensure fmt list gets closed when title cannot be checked
1 parent 458d230 commit 0d72ef5

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

autoload/go/fmt.vim

+11-9
Original file line numberDiff line numberDiff line change
@@ -129,17 +129,19 @@ function! go#fmt#update_file(source, target)
129129

130130
" the title information was introduced with 7.4-2200
131131
" https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
132-
if !has('patch-7.4-2200')
133-
return
134-
endif
135-
136-
" clean up previous list
137-
let l:listtype = go#list#Type("GoFmt")
138-
if l:listtype == "quickfix"
139-
let l:list_title = getqflist({'title': 1})
132+
if has('patch-7.4-2200')
133+
" clean up previous list
134+
let l:listtype = go#list#Type("GoFmt")
135+
if l:listtype == "quickfix"
136+
let l:list_title = getqflist({'title': 1})
137+
else
138+
let l:list_title = getloclist(0, {'title': 1})
139+
endif
140140
else
141-
let l:list_title = getloclist(0, {'title': 1})
141+
" can't check the title, so assume that the list was for go fmt.
142+
let l:list_title = {'title': 'Format'}
142143
endif
144+
143145
if has_key(l:list_title, "title") && l:list_title['title'] == "Format"
144146
call go#list#Clean(l:listtype)
145147
call go#list#Window(l:listtype)

0 commit comments

Comments
 (0)