Skip to content

Commit

Permalink
Merge pull request #1474 from bhcleek/close-gofmt-list-vim7.4
Browse files Browse the repository at this point in the history
ensure fmt list gets closed when title cannot be checked
  • Loading branch information
fatih authored Oct 3, 2017
2 parents be4133a + 1c1980f commit e3725d4
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions autoload/go/fmt.vim
Original file line number Diff line number Diff line change
Expand Up @@ -127,19 +127,22 @@ function! go#fmt#update_file(source, target)
let &fileformat = old_fileformat
let &syntax = &syntax

let l:listtype = go#list#Type("GoFmt")

" the title information was introduced with 7.4-2200
" https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
if !has('patch-7.4-2200')
return
endif

" clean up previous list
let l:listtype = go#list#Type("GoFmt")
if l:listtype == "quickfix"
let l:list_title = getqflist({'title': 1})
if has('patch-7.4-2200')
" clean up previous list
if l:listtype == "quickfix"
let l:list_title = getqflist({'title': 1})
else
let l:list_title = getloclist(0, {'title': 1})
endif
else
let l:list_title = getloclist(0, {'title': 1})
" can't check the title, so assume that the list was for go fmt.
let l:list_title = {'title': 'Format'}
endif

if has_key(l:list_title, "title") && l:list_title['title'] == "Format"
call go#list#Clean(l:listtype)
call go#list#Window(l:listtype)
Expand Down

0 comments on commit e3725d4

Please sign in to comment.