Skip to content

Commit f80622f

Browse files
authored
Merge pull request fatih#1724 from fatih/list-clear
list: make Clean() more useful
2 parents 9463308 + 8d040e1 commit f80622f

File tree

8 files changed

+18
-20
lines changed

8 files changed

+18
-20
lines changed

autoload/go/fmt.vim

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ function! go#fmt#update_file(source, target)
148148

149149
if has_key(l:list_title, "title") && l:list_title['title'] == "Format"
150150
call go#list#Clean(l:listtype)
151-
call go#list#Window(l:listtype)
152151
endif
153152
endfunction
154153

autoload/go/job.vim

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,12 @@ function go#job#Spawn(args)
107107
let l:listtype = go#list#Type(self.for)
108108
if a:exit_status == 0
109109
call go#list#Clean(l:listtype)
110-
call go#list#Window(l:listtype)
111110
return
112111
endif
113112

114113
let l:listtype = go#list#Type(self.for)
115114
if len(a:data) == 0
116115
call go#list#Clean(l:listtype)
117-
call go#list#Window(l:listtype)
118116
return
119117
endif
120118

autoload/go/jobcontrol.vim

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ function! s:on_exit(job_id, exit_status, event) dict abort
126126
let l:listtype = go#list#Type(self.for)
127127
if a:exit_status == 0
128128
call go#list#Clean(l:listtype)
129-
call go#list#Window(l:listtype)
130129

131130
let self.state = "SUCCESS"
132131

autoload/go/lint.vim

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ function! go#lint#Gometa(autosave, ...) abort
105105

106106
if l:err == 0
107107
call go#list#Clean(l:listtype)
108-
call go#list#Window(l:listtype)
109108
echon "vim-go: " | echohl Function | echon "[metalinter] PASS" | echohl None
110109
else
111110
" GoMetaLinter can output one of the two, so we look for both:
@@ -176,7 +175,6 @@ function! go#lint#Vet(bang, ...) abort
176175
echon "vim-go: " | echohl ErrorMsg | echon "[vet] FAIL" | echohl None
177176
else
178177
call go#list#Clean(l:listtype)
179-
call go#list#Window(l:listtype)
180178
redraw | echon "vim-go: " | echohl Function | echon "[vet] PASS" | echohl None
181179
endif
182180
endfunction
@@ -229,7 +227,6 @@ function! go#lint#Errcheck(...) abort
229227
endif
230228
else
231229
call go#list#Clean(l:listtype)
232-
call go#list#Window(l:listtype)
233230
echon "vim-go: " | echohl Function | echon "[errcheck] PASS" | echohl None
234231
endif
235232

autoload/go/list.vim

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,7 @@ function! go#list#Window(listtype, ...) abort
1818
" location list increases/decreases, cwindow will not resize when a new
1919
" updated height is passed. lopen in the other hand resizes the screen.
2020
if !a:0 || a:1 == 0
21-
let autoclose_window = get(g:, 'go_list_autoclose', 1)
22-
if autoclose_window
23-
if a:listtype == "locationlist"
24-
lclose
25-
else
26-
cclose
27-
endif
28-
endif
21+
call go#list#Close(a:listtype)
2922
return
3023
endif
3124

@@ -107,13 +100,29 @@ function! go#list#JumpToFirst(listtype) abort
107100
endif
108101
endfunction
109102

110-
" Clean cleans the location list
103+
" Clean cleans and closes the location list
111104
function! go#list#Clean(listtype) abort
112105
if a:listtype == "locationlist"
113106
lex []
114107
else
115108
cex []
116109
endif
110+
111+
call go#list#Close(a:listtype)
112+
endfunction
113+
114+
" Close closes the location list
115+
function! go#list#Close(listtype) abort
116+
let autoclose_window = get(g:, 'go_list_autoclose', 1)
117+
if !autoclose_window
118+
return
119+
endif
120+
121+
if a:listtype == "locationlist"
122+
lclose
123+
else
124+
cclose
125+
endif
117126
endfunction
118127

119128
function! s:listtype(listtype) abort

autoload/go/rename.vim

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ function s:parse_errors(exit_val, bang, out)
160160
" strip out newline on the end that gorename puts. If we don't remove, it
161161
" will trigger the 'Hit ENTER to continue' prompt
162162
call go#list#Clean(l:listtype)
163-
call go#list#Window(l:listtype)
164163
call go#util#EchoSuccess(a:out[0])
165164

166165
" refresh the buffer so we can see the new content

autoload/go/term.vim

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ function s:cleanlist(winnr, listtype) abort
123123
let l:winnr = winnr()
124124
execute a:winnr . "wincmd w"
125125
call go#list#Clean(a:listtype)
126-
call go#list#Window(a:listtype)
127126
execute l:winnr . "wincmd w"
128127
endfunction
129128

autoload/go/test.vim

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ function! go#test#Test(bang, compile, ...) abort
9494
call go#util#EchoError("[test] FAIL")
9595
else
9696
call go#list#Clean(l:listtype)
97-
call go#list#Window(l:listtype)
9897

9998
if a:compile
10099
call go#util#EchoSuccess("[test] SUCCESS")
@@ -246,7 +245,6 @@ function! s:show_errors(args, exit_val, messages) abort
246245
let l:listtype = go#list#Type("GoTest")
247246
if a:exit_val == 0
248247
call go#list#Clean(l:listtype)
249-
call go#list#Window(l:listtype)
250248
return
251249
endif
252250

0 commit comments

Comments
 (0)