Skip to content

Commit cf8ddc7

Browse files
committed
Switch to loclist
1 parent 3485b69 commit cf8ddc7

File tree

5 files changed

+42
-13
lines changed

5 files changed

+42
-13
lines changed

autoload/pymode.vim

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,17 @@ fun! pymode#buffer_pre_write() "{{{
110110
endfunction
111111

112112
fun! pymode#buffer_post_write() "{{{
113-
if b:pymode_modified && g:pymode_rope_regenerate_on_write
114-
call pymode#debug('regenerate')
115-
call pymode#rope#regenerate()
113+
if g:pymode_rope
114+
if b:pymode_modified && g:pymode_rope_regenerate_on_write
115+
call pymode#debug('regenerate')
116+
call pymode#rope#regenerate()
117+
endif
116118
endif
117-
if g:pymode_lint_unmodified || (g:pymode_lint_on_write && b:pymode_modified)
118-
call pymode#debug('check code')
119-
call pymode#lint#check()
119+
if g:pymode_lint
120+
if g:pymode_lint_unmodified || (g:pymode_lint_on_write && b:pymode_modified)
121+
call pymode#debug('check code')
122+
call pymode#lint#check()
123+
endif
120124
endif
121125
endfunction "}}}
122126

autoload/pymode/lint.vim

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ fun! pymode#lint#check() "{{{
6565
call g:PymodeSigns.refresh(loclist)
6666

6767
if g:pymode_lint_cwindow
68-
call setqflist(loclist._loclist)
69-
call pymode#quickfix_open(0, g:pymode_quickfix_maxheight, g:pymode_quickfix_minheight, 0)
68+
call loclist.show()
7069
endif
7170

7271
call pymode#lint#show_errormessage()

autoload/pymode/rope.vim

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"
33
PymodePython from pymode import rope
44

5+
call pymode#tools#loclist#init()
6+
57

68
fun! pymode#rope#completions(findstart, base)
79
PymodePython rope.completions()
@@ -56,8 +58,10 @@ fun! pymode#rope#find_it()
5658
PymodePython rope.find_it()
5759
call pymode#wide_message('')
5860
if !empty(l:output)
59-
call setqflist(l:output)
60-
call pymode#quickfix_open(0, g:pymode_quickfix_maxheight, g:pymode_quickfix_minheight, 0)
61+
let loclist = g:PymodeLocList.current()
62+
let loclist._loclist = l:output
63+
let loclist._title = "Occurrences"
64+
call loclist.show()
6165
end
6266
endfunction
6367

autoload/pymode/run.vim

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ let s:efm .= '%-G%.%#'
4343

4444
PymodePython from pymode.run import run_code
4545

46+
call pymode#tools#loclist#init()
47+
4648

4749
" DESC: Run python code
4850
fun! pymode#run#code_run(line1, line2) "{{{
@@ -86,7 +88,11 @@ fun! pymode#run#code_run(line1, line2) "{{{
8688
call setqflist(qflist)
8789
endif
8890

89-
call pymode#quickfix_open(0, g:pymode_quickfix_maxheight, g:pymode_quickfix_maxheight, 0)
91+
let loclist = g:PymodeLocList.current()
92+
let loclist._loclist = getqflist()
93+
let loclist._title = "Run errors"
94+
call loclist.show()
95+
9096
let &efm = l:_efm
9197

9298
catch /E234/

autoload/pymode/tools/loclist.vim

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ fun! g:PymodeLocList.init(raw_list) "{{{
1010
let obj = copy(self)
1111
let loc_list = filter(copy(a:raw_list), 'v:val["valid"] == 1')
1212
call obj.clear()
13+
let obj._title = 'CodeCheck'
1314
return obj
1415
endfunction "}}}
1516

@@ -18,7 +19,6 @@ fun! g:PymodeLocList.current() "{{{
1819
if !exists("b:pymode_loclist")
1920
let b:pymode_loclist = g:PymodeLocList.init([])
2021
endif
21-
let b:pymode_loclist._bufnr = bufnr('.')
2222
return b:pymode_loclist
2323
endfunction "}}}
2424

@@ -31,7 +31,7 @@ endfunction "}}}
3131
fun! g:PymodeLocList.clear() "{{{
3232
let self._loclist = []
3333
let self._messages = {}
34-
let self._bufnr = bufnr('')
34+
let self._name = expand('%:t')
3535
endfunction "}}}
3636

3737

@@ -62,3 +62,19 @@ fun! g:PymodeLocList.filter(filters) "{{{
6262
endfor
6363
return loclist
6464
endfunction "}}}
65+
66+
67+
fun! g:PymodeLocList.show() "{{{
68+
call setloclist(0, self._loclist)
69+
if self.is_empty()
70+
lclose
71+
else
72+
let num = winnr()
73+
execute "lopen " . g:pymode_quickfix_maxheight
74+
execute max([min([line("$"), g:pymode_quickfix_maxheight]), g:pymode_quickfix_minheight]) . "wincmd _"
75+
if num != winnr()
76+
call setwinvar(winnr(), 'quickfix_title', self._title . ' <' . self._name . '>')
77+
wincmd p
78+
endif
79+
end
80+
endfunction "}}}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy