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,37 @@ fun! pymode#lint#toggle() "{{{
3944 end
4045endfunction " }}}
4146
47+
4248fun ! pymode#lint#check () " {{{
4349 " DESC: Run checkers on current file.
4450 "
45- if ! g: pymode_lint | return | endif
51+ let loclist = g: PymodeLocList .current ()
52+
53+ let b: pymode_error_line = -1
4654
47- let b: pymode_errors = {}
55+ call loclist. clear ()
4856
4957 call pymode#wide_message (' Code checking is running ...' )
5058
5159 PymodePython code_check ()
5260
53- let errors = getqflist ()
54- if empty (errors)
61+ if loclist.is_empty ()
5562 call pymode#wide_message (' Code checking is completed. No errors found.' )
5663 endif
5764
65+ call g: PymodeSigns .refresh (loclist)
66+
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
76-
77- let b: pymode_error_line = -1
7872 call pymode#lint#show_errormessage ()
79- call pymode#wide_message (' Found errors and warnings: ' . len (errors ))
73+ call pymode#wide_message (' Found errors and warnings: ' . len (loclist._loclist ))
8074
8175endfunction " }}}
8276
77+
8378fun ! pymode#lint#tick_queue () " {{{
8479
8580 python import time
@@ -96,11 +91,13 @@ fun! pymode#lint#tick_queue() "{{{
9691 endif
9792endfunction " }}}
9893
94+
9995fun ! pymode#lint#stop () " {{{
10096 au ! pymode CursorHold <buffer>
101- endfunction
97+ endfunction " }}}
98+
10299
103100fun ! pymode#lint#start () " {{{
104101 au ! pymode CursorHold <buffer> call pymode#lint#tick_queue ()
105102 call pymode#lint#tick_queue ()
106- endfunction
103+ endfunction " }}}
0 commit comments