pydoc works now also if the cursor is on the class / created context possibility for completions (backward tokenizer)

This commit is contained in:
David Halter
2012-09-05 14:19:40 +02:00
parent 734fb5d3cf
commit a6ffae1776

View File

@@ -109,9 +109,11 @@ if 1:
vim.command('normal! K') vim.command('normal! K')
vim.command('return') vim.command('return')
else: else:
docs = ['|Docstring of %s|\n%s' % (d, d.doc) for d in definitions] docs = ['|Docstring for %s|\n%s' % (d, d.doc) if d.doc
text = ('-' * 79).join(docs) else '|No Docstring for %s|' % d for d in definitions]
text = ('\n' + '-' * 79 + '\n').join(docs)
vim.command('let l:doc = %s' % repr(PythonToVimStr(text))) vim.command('let l:doc = %s' % repr(PythonToVimStr(text)))
vim.command('let l:doc_lines = %s' % len(text.split('\n')))
PYTHONEOF PYTHONEOF
if bufnr("__doc__") > 0 if bufnr("__doc__") > 0
" If the __doc__ buffer is open in the current window, jump to it " If the __doc__ buffer is open in the current window, jump to it
@@ -119,6 +121,7 @@ PYTHONEOF
else else
split '__doc__' split '__doc__'
endif endif
setlocal modifiable setlocal modifiable
setlocal noswapfile setlocal noswapfile
setlocal buftype=nofile setlocal buftype=nofile
@@ -128,6 +131,11 @@ PYTHONEOF
setlocal nomodifiable setlocal nomodifiable
setlocal nomodified setlocal nomodified
if l:doc_lines > 20 " max 20 lines for plugin
let l:doc_lines = 20
endif
execute "resize ".l:doc_lines
" TODO more highlightings " TODO more highlightings
highlight jedi_doc ctermbg=green guibg=green highlight jedi_doc ctermbg=green guibg=green
match jedi_doc /^|.*|\n/ match jedi_doc /^|.*|\n/