forked from VimPlug/jedi-vim
completions: skip docstr without preview, handle exceptions (#958)
Closes https://github.com/davidhalter/jedi-vim/issues/948.
This commit is contained in:
@@ -305,16 +305,22 @@ def completions():
|
|||||||
completions = script.completions()
|
completions = script.completions()
|
||||||
signatures = script.call_signatures()
|
signatures = script.call_signatures()
|
||||||
|
|
||||||
|
add_info = "preview" in vim.eval("&completeopt").split(",")
|
||||||
out = []
|
out = []
|
||||||
for c in completions:
|
for c in completions:
|
||||||
d = dict(word=PythonToVimStr(c.name[:len(base)] + c.complete),
|
d = dict(word=PythonToVimStr(c.name[:len(base)] + c.complete),
|
||||||
abbr=PythonToVimStr(c.name_with_symbols),
|
abbr=PythonToVimStr(c.name_with_symbols),
|
||||||
# stuff directly behind the completion
|
# stuff directly behind the completion
|
||||||
menu=PythonToVimStr(c.description),
|
menu=PythonToVimStr(c.description),
|
||||||
info=PythonToVimStr(c.docstring()), # docstr
|
|
||||||
icase=1, # case insensitive
|
icase=1, # case insensitive
|
||||||
dup=1 # allow duplicates (maybe later remove this)
|
dup=1 # allow duplicates (maybe later remove this)
|
||||||
)
|
)
|
||||||
|
if add_info:
|
||||||
|
try:
|
||||||
|
d["info"] = PythonToVimStr(c.docstring())
|
||||||
|
except Exception:
|
||||||
|
print("jedi-vim: error with docstring for %r: %s" % (
|
||||||
|
c, traceback.format_exc()))
|
||||||
out.append(d)
|
out.append(d)
|
||||||
|
|
||||||
strout = str(out)
|
strout = str(out)
|
||||||
|
|||||||
Reference in New Issue
Block a user