diff --git a/autoload/go/cmd.vim b/autoload/go/cmd.vim index 33fccd3ab0..f0a74d2ddc 100644 --- a/autoload/go/cmd.vim +++ b/autoload/go/cmd.vim @@ -129,7 +129,7 @@ function! go#cmd#Run(bang, ...) let items = go#list#Get(l:listtype) let errors = go#tool#FilterValids(items) - call go#list#Populate(l:listtype, errors) + call go#list#Populate(l:listtype, errors, &makeprg) call go#list#Window(l:listtype, len(errors)) if !empty(errors) && !a:bang call go#list#JumpToFirst(l:listtype) @@ -251,7 +251,7 @@ function! go#cmd#Test(bang, compile, ...) let errors = go#tool#ParseErrors(split(out, '\n')) let errors = go#tool#FilterValids(errors) - call go#list#Populate(l:listtype, errors) + call go#list#Populate(l:listtype, errors, command) call go#list#Window(l:listtype, len(errors)) if !empty(errors) && !a:bang call go#list#JumpToFirst(l:listtype) diff --git a/autoload/go/fmt.vim b/autoload/go/fmt.vim index b55ba83d7c..d23bfc180e 100644 --- a/autoload/go/fmt.vim +++ b/autoload/go/fmt.vim @@ -185,7 +185,7 @@ function! go#fmt#Format(withGoimport) % | " Couldn't detect gofmt error format, output errors endif if !empty(errors) - call go#list#Populate(l:listtype, errors) + call go#list#Populate(l:listtype, errors, 'Format') echohl Error | echomsg "Gofmt returned error" | echohl None endif diff --git a/autoload/go/guru.vim b/autoload/go/guru.vim index c1f7f193c5..b16c1d71e9 100644 --- a/autoload/go/guru.vim +++ b/autoload/go/guru.vim @@ -115,7 +115,7 @@ endfunc " and put it into location list. I believe using errorformat is much more " easier to use. If we need more power we can always switch back to parse it " via regex. -func! s:loclistSecond(output) +func! s:loclistSecond(output, title) " backup users errorformat, will be restored once we are finished let old_errorformat = &errorformat @@ -128,7 +128,7 @@ func! s:loclistSecond(output) " useful and location only has the ability to show one line and column " number let errformat = "%f:%l.%c-%[%^:]%#:\ %m,%f:%l:%c:\ %m" - call go#list#ParseFormat("locationlist", errformat, split(a:output, "\n")) + call go#list#ParseFormat("locationlist", errformat, split(a:output, "\n"), a:title) let errors = go#list#Get("locationlist") call go#list#Window("locationlist", len(errors)) @@ -189,7 +189,7 @@ function! go#guru#Whicherrs(selected) return endif - call s:loclistSecond(out.out) + call s:loclistSecond(out.out, 'Whicherrs') endfunction " Show 'implements' relation for selected package @@ -200,7 +200,7 @@ function! go#guru#Implements(selected) return endif - call s:loclistSecond(out.out) + call s:loclistSecond(out.out, 'Implements') endfunction " Describe selected syntax: definition, methods, etc @@ -211,7 +211,7 @@ function! go#guru#Describe(selected) return endif - call s:loclistSecond(out.out) + call s:loclistSecond(out.out, 'Describe') endfunction " Show possible targets of selected function call @@ -222,7 +222,7 @@ function! go#guru#Callees(selected) return endif - call s:loclistSecond(out.out) + call s:loclistSecond(out.out, 'Callees') endfunction " Show possible callers of selected function @@ -233,7 +233,7 @@ function! go#guru#Callers(selected) return endif - call s:loclistSecond(out.out) + call s:loclistSecond(out.out, 'Callers') endfunction " Show path from callgraph root to selected function @@ -244,7 +244,7 @@ function! go#guru#Callstack(selected) return endif - call s:loclistSecond(out.out) + call s:loclistSecond(out.out, 'Callback') endfunction " Show free variables of selection @@ -261,7 +261,7 @@ function! go#guru#Freevars(selected) return endif - call s:loclistSecond(out.out) + call s:loclistSecond(out.out, 'Freevars') endfunction " Show send/receive corresponding to selected channel op @@ -272,7 +272,7 @@ function! go#guru#ChannelPeers(selected) return endif - call s:loclistSecond(out.out) + call s:loclistSecond(out.out, 'ChannelPeers') endfunction " Show all refs to entity denoted by selected identifier @@ -283,7 +283,7 @@ function! go#guru#Referrers(selected) return endif - call s:loclistSecond(out.out) + call s:loclistSecond(out.out, 'Referrers') endfunction function! go#guru#What(selected) diff --git a/autoload/go/jobcontrol.vim b/autoload/go/jobcontrol.vim index e03c75d66b..d2850b3fdd 100644 --- a/autoload/go/jobcontrol.vim +++ b/autoload/go/jobcontrol.vim @@ -150,7 +150,7 @@ function! s:on_exit(job_id, exit_status) " if we are still in the same windows show the list if self.winnr == winnr() let l:listtype = "locationlist" - call go#list#Populate(l:listtype, errors) + call go#list#Populate(l:listtype, errors, self.desc) call go#list#Window(l:listtype, len(errors)) if !empty(errors) && !self.bang call go#list#JumpToFirst(l:listtype) diff --git a/autoload/go/lint.vim b/autoload/go/lint.vim index 9b2a543a29..1b1c7f1f4d 100644 --- a/autoload/go/lint.vim +++ b/autoload/go/lint.vim @@ -77,7 +77,7 @@ function! go#lint#Gometa(autosave, ...) abort let errformat = "%f:%l:%c:%t%*[^:]:\ %m,%f:%l::%t%*[^:]:\ %m" " Parse and populate our location list - call go#list#ParseFormat(l:listtype, errformat, split(out, "\n")) + call go#list#ParseFormat(l:listtype, errformat, split(out, "\n"), 'GoMetaLinter') let errors = go#list#Get(l:listtype) call go#list#Window(l:listtype, len(errors)) @@ -129,7 +129,7 @@ function! go#lint#Vet(bang, ...) let l:listtype = "quickfix" if go#util#ShellError() != 0 let errors = go#tool#ParseErrors(split(out, '\n')) - call go#list#Populate(l:listtype, errors) + call go#list#Populate(l:listtype, errors, 'Vet') call go#list#Window(l:listtype, len(errors)) if !empty(errors) && !a:bang call go#list#JumpToFirst(l:listtype) @@ -171,7 +171,7 @@ function! go#lint#Errcheck(...) abort let errformat = "%f:%l:%c:\ %m, %f:%l:%c\ %#%m" " Parse and populate our location list - call go#list#ParseFormat(l:listtype, errformat, split(out, "\n")) + call go#list#ParseFormat(l:listtype, errformat, split(out, "\n"), 'Errcheck') let errors = go#list#Get(l:listtype) @@ -182,7 +182,7 @@ function! go#lint#Errcheck(...) abort endif if !empty(errors) - call go#list#Populate(l:listtype, errors) + call go#list#Populate(l:listtype, errors, 'Errcheck') call go#list#Window(l:listtype, len(errors)) if !empty(errors) call go#list#JumpToFirst(l:listtype) diff --git a/autoload/go/list.vim b/autoload/go/list.vim index 6859a9f3e9..ce2be76369 100644 --- a/autoload/go/list.vim +++ b/autoload/go/list.vim @@ -50,12 +50,14 @@ function! go#list#Get(listtype) endfunction " Populate populate the location list with the given items -function! go#list#Populate(listtype, items) +function! go#list#Populate(listtype, items, title) let l:listtype = go#list#Type(a:listtype) if l:listtype == "locationlist" call setloclist(0, a:items, 'r') + call setloclist(0, [], 'a', {'title': a:title}) else call setqflist(a:items, 'r') + call setqflist([], 'a', {'title': a:title}) endif endfunction @@ -65,7 +67,7 @@ endfunction " Parse parses the given items based on the specified errorformat nad " populates the location list. -function! go#list#ParseFormat(listtype, errformat, items) +function! go#list#ParseFormat(listtype, errformat, items, title) let l:listtype = go#list#Type(a:listtype) " backup users errorformat, will be restored once we are finished let old_errorformat = &errorformat @@ -74,8 +76,10 @@ function! go#list#ParseFormat(listtype, errformat, items) let &errorformat = a:errformat if l:listtype == "locationlist" lgetexpr a:items + call setloclist(0, [], 'a', {'title': a:title}) else cgetexpr a:items + call setqflist([], 'a', {'title': a:title}) endif "restore back diff --git a/autoload/go/rename.vim b/autoload/go/rename.vim index d65256c517..3ff95916fc 100644 --- a/autoload/go/rename.vim +++ b/autoload/go/rename.vim @@ -52,7 +52,7 @@ function! go#rename#Rename(bang, ...) let l:listtype = "quickfix" if go#util#ShellError() != 0 let errors = go#tool#ParseErrors(split(out, '\n')) - call go#list#Populate(l:listtype, errors) + call go#list#Populate(l:listtype, errors, 'Rename') call go#list#Window(l:listtype, len(errors)) if !empty(errors) && !a:bang call go#list#JumpToFirst(l:listtype) diff --git a/autoload/go/term.vim b/autoload/go/term.vim index 08947fa947..ae8a50332e 100644 --- a/autoload/go/term.vim +++ b/autoload/go/term.vim @@ -53,6 +53,7 @@ function! go#term#newmode(bang, cmd, mode) let $GOPATH = old_gopath let job.id = id + let job.cmd = a:cmd startinsert " resize new term if needed. @@ -115,7 +116,7 @@ function! s:on_exit(job_id, exit_status) " close terminal we don't need it anymore close - call go#list#Populate(l:listtype, errors) + call go#list#Populate(l:listtype, errors, job.cmd) call go#list#Window(l:listtype, len(errors)) if !self.bang call go#list#JumpToFirst(l:listtype)