mirror of
https://github.com/davidhalter/jedi-vim.git
synced 2025-12-07 11:14:32 +08:00
better support for in call displays (bugfixes)
This commit is contained in:
@@ -9,7 +9,7 @@ if g:jedi#show_function_definition == 1 && has('conceal')
|
||||
syn match jediFatSymbol "*" contained conceal
|
||||
syn match jediFat "\*[^*]\+\*" contained contains=jediFatSymbol
|
||||
syn match jediSpace "\v[ ]+( )@=" contained
|
||||
exe 'syn match jediFunction "'.l1.'" contains=jediIgnore,jediFat,jediSpace'
|
||||
exe 'syn match jediFunction "'.l1.'" keepend extend contains=jediIgnore,jediFat,jediSpace'
|
||||
|
||||
hi def link jediIgnore Ignore
|
||||
hi def link jediFatSymbol Ignore
|
||||
@@ -31,5 +31,4 @@ if g:jedi#show_function_definition == 1 && has('conceal')
|
||||
syn region pythonRawString
|
||||
\ start=+[uU]\=[rR]\z('''\|"""\)+ end="\z1" keepend
|
||||
\ contains=pythonSpaceError,pythonDoctest,@Spell,jediFunction
|
||||
|
||||
endif
|
||||
|
||||
@@ -180,6 +180,10 @@ def show_func_def(call_def, completion_lines=0):
|
||||
except (IndexError, TypeError):
|
||||
pass
|
||||
|
||||
# This stuff is reaaaaally a hack! I cannot stress enough, that this is a
|
||||
# stupid solution. But there is really no other yet. There is no
|
||||
# possibility in VIM to draw on the screen, but there will be one
|
||||
# (see :help todo Patch to access screen under Python. (Marko Mahni, 2010 Jul 18))
|
||||
text = " (%s) " % ', '.join(params)
|
||||
text = ' ' * (insert_column - len(line)) + text
|
||||
end_column = insert_column + len(text) - 2 # -2 because of bold symbols
|
||||
@@ -187,11 +191,16 @@ def show_func_def(call_def, completion_lines=0):
|
||||
e = vim.eval('g:jedi#function_definition_escape')
|
||||
regex = "xjedi=%sx%sxjedix".replace('x', e)
|
||||
|
||||
prefix, replace = line[:insert_column], line[insert_column:end_column]
|
||||
# check the replace stuff for strings, to append them (don't want to break the syntax)
|
||||
replace = line[insert_column:end_column]
|
||||
add = ''.join(re.findall('\\\\*["\']+', replace)) # add are all the strings
|
||||
regex_quotes = '\\\\*["\']+'
|
||||
add = ''.join(re.findall(regex_quotes, replace)) # add are all the strings
|
||||
if add:
|
||||
a = re.search(regex_quotes + '$', prefix)
|
||||
add = ('' if a is None else a.group(0)) + add
|
||||
|
||||
tup = '%s, %s' % (len(add), replace)
|
||||
repl = ("%s" + regex + "%s") % (line[:insert_column], tup, text, add + line[end_column:])
|
||||
repl = ("%s" + regex + "%s") % (prefix, tup, text, add + line[end_column:])
|
||||
|
||||
vim.eval('setline(%s, %s)' % (row_to_replace, repr(PythonToVimStr(repl))))
|
||||
PYTHONEOF
|
||||
|
||||
Reference in New Issue
Block a user