11PymodePython from pymode.lintimport code_check
22
3+ call pymode#tools#signs#init ()
4+ call pymode#tools#loclist#init ()
5+
6+
37fun ! pymode#lint#auto ()" {{{
48if ! pymode#save ()
59return 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 ()
1722return
1823endif
1924
@@ -22,8 +27,8 @@ fun! pymode#lint#show_errormessage() "{{{
2227return
2328endif
2429let 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 ])
2732else
2833echo
2934endif
@@ -39,47 +44,37 @@ fun! pymode#lint#toggle() "{{{
3944end
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
4957call pymode#wide_message (' Code checking is running ...' )
5058
5159 PymodePythoncode_check ()
5260
53- let errors= getqflist ()
54- if empty (errors)
61+ if loclist.is_empty ()
5562call pymode#wide_message (' Code checking is completed. No errors found.' )
5663endif
5764
65+ call g: PymodeSigns .refresh (loclist)
66+
5867if g: pymode_lint_cwindow
68+ call setqflist (loclist._loclist)
5969call pymode#quickfix_open (0 ,g: pymode_quickfix_maxheight ,g: pymode_quickfix_minheight ,0 )
6070endif
6171
62- if g: pymode_lint_signs
63- for itemin 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 itemin 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 itemin errors
74- let b: pymode_errors [item.lnum]= item.text
75- endfor
76-
77- let b: pymode_error_line= -1
7872call 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
8580python import time
@@ -96,11 +91,13 @@ fun! pymode#lint#tick_queue() "{{{
9691endif
9792endfunction " }}}
9893
94+
9995fun ! pymode#lint#stop ()" {{{
10096au ! pymodeCursorHold <buffer>
101- endfunction
97+ endfunction " }}}
98+
10299
103100fun ! pymode#lint#start ()" {{{
104101au ! pymodeCursorHold <buffer> call pymode#lint#tick_queue ()
105102call pymode#lint#tick_queue ()
106- endfunction
103+ endfunction " }}}