better support for in call displays (bugfixes)

This commit is contained in:
David Halter
2012-10-13 00:15:04 +02:00
parent 15426a3d51
commit 48ab6c613f
2 changed files with 13 additions and 5 deletions

View File

@@ -9,7 +9,7 @@ if g:jedi#show_function_definition == 1 && has('conceal')
syn match jediFatSymbol "*" contained conceal syn match jediFatSymbol "*" contained conceal
syn match jediFat "\*[^*]\+\*" contained contains=jediFatSymbol syn match jediFat "\*[^*]\+\*" contained contains=jediFatSymbol
syn match jediSpace "\v[ ]+( )@=" contained 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 jediIgnore Ignore
hi def link jediFatSymbol Ignore hi def link jediFatSymbol Ignore
@@ -31,5 +31,4 @@ if g:jedi#show_function_definition == 1 && has('conceal')
syn region pythonRawString syn region pythonRawString
\ start=+[uU]\=[rR]\z('''\|"""\)+ end="\z1" keepend \ start=+[uU]\=[rR]\z('''\|"""\)+ end="\z1" keepend
\ contains=pythonSpaceError,pythonDoctest,@Spell,jediFunction \ contains=pythonSpaceError,pythonDoctest,@Spell,jediFunction
endif endif

View File

@@ -180,6 +180,10 @@ def show_func_def(call_def, completion_lines=0):
except (IndexError, TypeError): except (IndexError, TypeError):
pass 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 = " (%s) " % ', '.join(params)
text = ' ' * (insert_column - len(line)) + text text = ' ' * (insert_column - len(line)) + text
end_column = insert_column + len(text) - 2 # -2 because of bold symbols 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') e = vim.eval('g:jedi#function_definition_escape')
regex = "xjedi=%sx%sxjedix".replace('x', e) 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) # check the replace stuff for strings, to append them (don't want to break the syntax)
replace = line[insert_column:end_column] regex_quotes = '\\\\*["\']+'
add = ''.join(re.findall('\\\\*["\']+', replace)) # add are all the strings 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) 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)))) vim.eval('setline(%s, %s)' % (row_to_replace, repr(PythonToVimStr(repl))))
PYTHONEOF PYTHONEOF