11PymodePython from pymode.lint import code_check
22
3+ call pymode#tools#signs#init ()
4+ call pymode#tools#loclist#init ()
5+
6+
37fun ! pymode#lint#auto () " {{{
48 if ! pymode#save ()
59 return 0
@@ -13,7 +17,8 @@ endfunction "}}}
1317
1418
1519fun ! pymode#lint#show_errormessage () " {{{
16- if empty (b: pymode_errors )
20+ let loclist = g: PymodeLocList .current ()
21+ if loclist.is_empty ()
1722 return
1823 endif
1924
@@ -22,8 +27,8 @@ fun! pymode#lint#show_errormessage() "{{{
2227 return
2328 endif
2429 let b: pymode_error_line = l
25- if has_key (b: pymode_errors , l )
26- call pymode#wide_message (b: pymode_errors [l ])
30+ if has_key (loclist._messages , l )
31+ call pymode#wide_message (loclist._messages [l ])
2732 else
2833 echo
2934 endif
@@ -39,47 +44,39 @@ fun! pymode#lint#toggle() "{{{
3944 end
4045endfunction " }}}
4146
47+
4248fun ! pymode#lint#check () " {{{
4349 " DESC: Run checkers on current file.
4450 "
4551 if ! g: pymode_lint | return | endif
4652
47- let b: pymode_errors = {}
53+ let loclist = g: PymodeLocList .current ()
54+
55+ let b: pymode_error_line = -1
56+
57+ call loclist.clear ()
4858
4959 call pymode#wide_message (' Code checking is running ...' )
5060
5161 PymodePython code_check ()
5262
53- let errors = getqflist ()
54- if empty (errors)
63+ if loclist.is_empty ()
5564 call pymode#wide_message (' Code checking is completed. No errors found.' )
5665 endif
5766
5867 if g: pymode_lint_cwindow
68+ call setqflist (loclist._loclist)
5969 call pymode#quickfix_open (0 , g: pymode_quickfix_maxheight , g: pymode_quickfix_minheight , 0 )
6070 endif
6171
62- if g: pymode_lint_signs
63- for item in b: pymode_signs
64- execute printf (' sign unplace %d buffer=%d' , item.lnum, item.bufnr )
65- endfor
66- let b: pymode_lint_signs = []
67- for item in filter (errors, ' v:val.bufnr != ""' )
68- call add (b: pymode_signs , item)
69- execute printf (' sign place %d line=%d name=%s buffer=%d' , item.lnum, item.lnum, " Pymode" .item.type , item.bufnr )
70- endfor
71- endif
72-
73- for item in errors
74- let b: pymode_errors [item.lnum] = item.text
75- endfor
72+ call g: PymodeSigns .refresh (loclist)
7673
77- let b: pymode_error_line = -1
7874 call pymode#lint#show_errormessage ()
79- call pymode#wide_message (' Found errors and warnings: ' . len (errors ))
75+ call pymode#wide_message (' Found errors and warnings: ' . len (loclist._loclist ))
8076
8177endfunction " }}}
8278
79+
8380fun ! pymode#lint#tick_queue () " {{{
8481
8582 python import time
@@ -96,11 +93,13 @@ fun! pymode#lint#tick_queue() "{{{
9693 endif
9794endfunction " }}}
9895
96+
9997fun ! pymode#lint#stop () " {{{
10098 au ! pymode CursorHold <buffer>
101- endfunction
99+ endfunction " }}}
100+
102101
103102fun ! pymode#lint#start () " {{{
104103 au ! pymode CursorHold <buffer> call pymode#lint#tick_queue ()
105104 call pymode#lint#tick_queue ()
106- endfunction
105+ endfunction " }}}
0 commit comments