Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb65f669

Browse files
committed
Fix Rope
1 parent892aa7d commitb65f669

File tree

10 files changed

+233
-54
lines changed

10 files changed

+233
-54
lines changed

‎Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ clean:
99
.PHONY: test
1010
test:
1111
bundle install
12+
rm -rf$(CURDIR)/.ropeproject
1213
raketest
1314

1415
.PHONY: pylama

‎autoload/pymode/lint.vim

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
PymodePython from pymode.lintimport code_check
22

3+
callpymode#tools#signs#init()
4+
callpymode#tools#loclist#init()
5+
6+
37
fun!pymode#lint#auto()"{{{
48
if!pymode#save()
59
return0
@@ -13,7 +17,8 @@ endfunction "}}}
1317

1418

1519
fun!pymode#lint#show_errormessage()"{{{
16-
ifempty(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
letb:pymode_error_line=l
25-
ifhas_key(b:pymode_errors,l)
26-
callpymode#wide_message(b:pymode_errors[l])
30+
ifhas_key(loclist._messages,l)
31+
callpymode#wide_message(loclist._messages[l])
2732
else
2833
echo
2934
endif
@@ -39,47 +44,39 @@ fun! pymode#lint#toggle() "{{{
3944
end
4045
endfunction"}}}
4146

47+
4248
fun!pymode#lint#check()"{{{
4349
" DESC: Run checkers on current file.
4450
"
4551
if!g:pymode_lint |return |endif
4652

47-
letb:pymode_errors= {}
53+
let loclist=g:PymodeLocList.current()
54+
55+
letb:pymode_error_line=-1
56+
57+
call loclist.clear()
4858

4959
callpymode#wide_message('Code checking is running ...')
5060

5161
PymodePythoncode_check()
5262

53-
let errors=getqflist()
54-
ifempty(errors)
63+
if loclist.is_empty()
5564
callpymode#wide_message('Code checking is completed. No errors found.')
5665
endif
5766

5867
ifg:pymode_lint_cwindow
68+
callsetqflist(loclist._loclist)
5969
callpymode#quickfix_open(0,g:pymode_quickfix_maxheight,g:pymode_quickfix_minheight,0)
6070
endif
6171

62-
ifg:pymode_lint_signs
63-
for iteminb:pymode_signs
64-
executeprintf('sign unplace %d buffer=%d', item.lnum, item.bufnr)
65-
endfor
66-
letb:pymode_lint_signs= []
67-
for iteminfilter(errors,'v:val.bufnr != ""')
68-
calladd(b:pymode_signs, item)
69-
executeprintf('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-
letb:pymode_errors[item.lnum]= item.text
75-
endfor
72+
callg:PymodeSigns.refresh(loclist)
7673

77-
letb:pymode_error_line=-1
7874
callpymode#lint#show_errormessage()
79-
callpymode#wide_message('Found errors and warnings:' .len(errors))
75+
callpymode#wide_message('Found errors and warnings:' .len(loclist._loclist))
8076

8177
endfunction" }}}
8278

79+
8380
fun!pymode#lint#tick_queue()"{{{
8481

8582
pythonimport time
@@ -96,11 +93,13 @@ fun! pymode#lint#tick_queue() "{{{
9693
endif
9794
endfunction"}}}
9895

96+
9997
fun!pymode#lint#stop()"{{{
10098
au! pymodeCursorHold<buffer>
101-
endfunction
99+
endfunction"}}}
100+
102101

103102
fun!pymode#lint#start()"{{{
104103
au! pymodeCursorHold<buffer>callpymode#lint#tick_queue()
105104
callpymode#lint#tick_queue()
106-
endfunction
105+
endfunction"}}}

‎autoload/pymode/tools/loclist.vim

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
letg:PymodeLocList= {}
2+
3+
4+
fun!pymode#tools#loclist#init()"{{{
5+
return
6+
endfunction"}}}
7+
8+
9+
fun!g:PymodeLocList.init(raw_list)"{{{
10+
let obj=copy(self)
11+
let loc_list=filter(copy(a:raw_list),'v:val["valid"] == 1')
12+
call obj.clear()
13+
return obj
14+
endfunction"}}}
15+
16+
17+
fun!g:PymodeLocList.current()"{{{
18+
if!exists("b:pymode_loclist")
19+
letb:pymode_loclist=g:PymodeLocList.init([])
20+
endif
21+
returnb:pymode_loclist
22+
endfunction"}}}
23+
24+
25+
fun!g:PymodeLocList.is_empty()"{{{
26+
returnempty(self._loclist)
27+
endfunction"}}}
28+
29+
30+
fun!g:PymodeLocList.clear()"{{{
31+
letself._loclist= []
32+
letself._messages= {}
33+
endfunction"}}}
34+
35+
36+
fun!g:PymodeLocList.extend(raw_list)"{{{
37+
callextend(self._loclist,a:raw_list)
38+
for issueina:raw_list
39+
letself._messages[issue.lnum]= issue.text
40+
endfor
41+
returnself
42+
endfunction"}}}
43+
44+
45+
fun!g:PymodeLocList.filter(filters)"{{{
46+
let loclist= []
47+
forerrorinself._loclist
48+
let passes_filters=1
49+
forkeyinkeys(a:filters)
50+
ifget(error,key,'')!=?a:filters[key]
51+
let passes_filters=0
52+
break
53+
endif
54+
endfor
55+
56+
if passes_filters
57+
calladd(loclist,error)
58+
endif
59+
60+
endfor
61+
return loclist
62+
endfunction"}}}

‎autoload/pymode/tools/signs.vim

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
letg:PymodeSigns= {}
2+
3+
4+
fun!pymode#tools#signs#init()"{{{
5+
callg:PymodeSigns.setup()
6+
endfunction"}}}
7+
8+
9+
fun!g:PymodeSigns.enabled()"{{{
10+
return (g:pymode_lint_signs&&has('signs'))
11+
endfunction"}}}
12+
13+
14+
fun!g:PymodeSigns.setup()"{{{
15+
ifself.enabled()
16+
execute'sign define PymodeW text=' .g:pymode_lint_todo_symbol ." texthl=Todo"
17+
execute'sign define PymodeC text=' .g:pymode_lint_comment_symbol ." texthl=Comment"
18+
execute'sign define PymodeR text=' .g:pymode_lint_visual_symbol ." texthl=Visual"
19+
execute'sign define PymodeE text=' .g:pymode_lint_error_symbol ." texthl=Error"
20+
execute'sign define PymodeI text=' .g:pymode_lint_info_symbol ." texthl=Info"
21+
execute'sign define PymodeF text=' .g:pymode_lint_pyflakes_symbol ." texthl=Info"
22+
endif
23+
letself._sign_ids= []
24+
letself._next_id=10000
25+
letself._messages= {}
26+
endfunction"}}}
27+
28+
29+
fun!g:PymodeSigns.refresh(loclist)"{{{
30+
ifself.enabled()
31+
callself.clear()
32+
callself.place(a:loclist)
33+
endif
34+
endfunction"}}}
35+
36+
37+
fun!g:PymodeSigns.clear()"{{{
38+
let ids=copy(self._sign_ids)
39+
foriin ids
40+
execute"sign unplace" .i
41+
callremove(self._sign_ids,index(self._sign_ids,i))
42+
endfor
43+
endfunction"}}}
44+
45+
46+
fun!g:PymodeSigns.place(loclist)"{{{
47+
let seen= {}
48+
letbuf=bufnr('')
49+
for issueina:loclist._loclist
50+
if!has_key(seen, issue.lnum)
51+
let seen[issue.lnum]=1
52+
calladd(self._sign_ids,self._next_id)
53+
executeprintf('sign place %d line=%d name=%s buffer=%d',self._next_id, issue.lnum,"Pymode".issue.type[0],buf)
54+
letself._next_id+=1
55+
endif
56+
endfor
57+
endfunction"}}}

‎plugin/pymode.vim

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ com! PymodeTroubleshooting call pymode#troubleshooting#test()
66

77
" Enable pymode by default :)
88
callpymode#default('g:pymode',1)
9+
callpymode#default('g:pymode_debug',0)
910

1011
" DESC: Disable script loading
1112
if!g:pymode|| &cp
@@ -119,17 +120,6 @@ call pymode#default("g:pymode_lint_error_symbol", "EE")
119120
callpymode#default("g:pymode_lint_info_symbol","II")
120121
callpymode#default("g:pymode_lint_pyflakes_symbol","FF")
121122

122-
ifg:pymode_lint_signs&&has('signs')
123-
124-
execute'sign define PymodeW text=' .g:pymode_lint_todo_symbol ." texthl=Todo"
125-
execute'sign define PymodeC text=' .g:pymode_lint_comment_symbol ." texthl=Comment"
126-
execute'sign define PymodeR text=' .g:pymode_lint_visual_symbol ." texthl=Visual"
127-
execute'sign define PymodeE text=' .g:pymode_lint_error_symbol ." texthl=Error"
128-
execute'sign define PymodeI text=' .g:pymode_lint_info_symbol ." texthl=Info"
129-
execute'sign define PymodeF text=' .g:pymode_lint_pyflakes_symbol ." texthl=Info"
130-
131-
endif
132-
133123
" }}}
134124

135125
" SET/UNSET BREAKPOINTS {{{

‎pymode/lint.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77

88

99
defcode_check():
10-
""" Run pylama and check current file. """
10+
""" Run pylama and check current file.
11+
12+
:return bool:
13+
14+
"""
1115

1216
frompylama.mainimportparse_options
1317
frompylama.tasksimportcheck_path
@@ -37,15 +41,14 @@ def code_check():
3741
errors=check_path(path,options=options,code=code)
3842
sort_rules=vim.eval('g:pymode_lint_sort')
3943

40-
defsort(e):
44+
def__sort(e):
4145
try:
42-
print(e.get('type'))
4346
returnsort_rules.index(e.get('type'))
4447
exceptValueError:
4548
return999
4649

4750
ifsort_rules:
48-
print(sort_rules)
49-
errors=sorted(errors,key=sort)
51+
errors=sorted(errors,key=__sort)
5052

51-
vim.command('call setqflist(%s)'%json.dumps(errors))
53+
vim.command(
54+
'call g:PymodeLocList.current().extend(%s)'%json.dumps(errors))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp