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

Commit6d280c6

Browse files
committed
Fix docs, addg:pymode_lint_async option
1 parentdde90e7 commit6d280c6

File tree

6 files changed

+67
-6
lines changed

6 files changed

+67
-6
lines changed

‎autoload/pymode/doc.vim

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ fun! pymode#doc#Show(word) "{{{
88
Pythonimport StringIO
99
Python sys.stdout, _= StringIO.StringIO(), sys.stdout
1010
Pythonhelp(vim.eval('a:word'))
11-
callpymode#TempBuffer()
11+
Python sys.stdout, out= _, sys.stdout.getvalue()
12+
if!g:pymode_test
13+
callpymode#TempBuffer()
14+
endif
1215
Pythonvim.current.buffer.append(str(out).splitlines(),0)
1316
wincmdp
1417
endif

‎ftplugin/python/init-pymode.vim

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ if pymode#Default('g:pymode_init', 1)
22
finish
33
endif
44

5+
callpymode#Default('g:pymode_test',0)
6+
57
letg:pymode_version="0.6.18"
68

79
com! PymodeVersionechomsg"Current python-mode version:" .g:pymode_version
@@ -62,6 +64,9 @@ if !pymode#Default("g:pymode_lint", 1) || g:pymode_lint
6264
" OPTION: g:pymode_lint_write -- bool. Check code every save.
6365
callpymode#Default("g:pymode_lint_write",1)
6466

67+
" OPTION: g:pymode_lint_async -- bool. Run a checkers asynchronously
68+
callpymode#Default("g:pymode_lint_async",1)
69+
6570
" OPTION: g:pymode_lint_onfly -- bool. Check code every save.
6671
callpymode#Default("g:pymode_lint_onfly",0)
6772

‎pylibs/pymode/lint.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def check_file():
2121
""" Check current buffer. """
2222
buf=interface.get_current_buffer()
2323

24+
async=int(interface.get_option('lint_async'))
2425
linters=interface.get_option('lint_checker')
2526
ignore=interface.get_option('lint_ignore')
2627
select=interface.get_option('lint_select')
@@ -29,10 +30,15 @@ def check_file():
2930
options=parse_options(
3031
ignore=ignore,select=select,complexity=complexity,linters=linters)
3132

32-
add_task(
33-
run_checkers,callback=parse_result,title='Code checking',buf=buf,
34-
options=options,
35-
)
33+
ifasync:
34+
add_task(
35+
run_checkers,callback=parse_result,title='Code checking',
36+
buf=buf,options=options,
37+
)
38+
39+
else:
40+
result=run_checkers(buf=buf,options=options)
41+
parse_result(result,buf=buf)
3642

3743

3844
defrun_checkers(callback=None,buf=None,options=None):

‎t/pymode.vimrenamed to‎t/base.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
filetypepluginindenton
2+
sethidden
23

34
describe'pymode'
45

@@ -18,7 +19,6 @@ describe 'pymode'
1819
e test.py
1920
Pythonvim.current.buffer.append('Python is working.',0)
2021
Expectgetline(1)=='Python is working.'
21-
w
2222
end
2323

2424
end

‎t/docs.vim

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
filetypepluginindenton
2+
sethidden
3+
4+
describe'docs'
5+
before
6+
et/test.py
7+
letg:pymode_test=1
8+
end
9+
10+
it'pymode show docs'
11+
Pydocdef
12+
Expectgetline(1)=='Function definitions'
13+
Expect1==1
14+
end
15+
16+
end
17+

‎t/lint.vim

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
filetypepluginindenton
2+
sethidden
3+
4+
describe'pymode check code'
5+
6+
before
7+
et/test.py
8+
end
9+
10+
after
11+
close
12+
end
13+
14+
it'async'
15+
letg:pymode_lint_async=1
16+
PyLint
17+
Expectgetqflist()== []
18+
sleep1
19+
callpymode#queue#Poll()
20+
Expectgetqflist()== [{'lnum':2,'bufnr':1,'col':0,'valid':1,'vcol':0,'nr':0,'type':'E','pattern':'','text':'W0612 local variable "test" is assigned to but never used [pyflakes]'}]
21+
end
22+
23+
it'disable async'
24+
letg:pymode_lint_async=0
25+
PyLint
26+
Expectgetqflist()== [{'lnum':2,'bufnr':1,'col':0,'valid':1,'vcol':0,'nr':0,'type':'E','pattern':'','text':'W0612 local variable "test" is assigned to but never used [pyflakes]'}]
27+
end
28+
29+
end
30+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp