davidhalter / jedi-vim

Using the jedi autocompletion library for VIM.
MIT License
5.27k stars 370 forks source link

use of popup instead of preview window #1092

Closed Konfekt closed 1 year ago

Konfekt commented 1 year ago

Since Patch 8.1.1882 Vim offers the option popup superseding preview in &completeopt to show a popup instead of preview window on completion. However, with latest Jedi-Vim from Git Master

let g:jedi#auto_vim_configuration=0
set completeopt=menuone,longest,popup

won't show a popup window. Instead,

let g:jedi#auto_vim_configuration=0
set completeopt=menuone,longest,popup,preview

does, even though popup supersedes preview.

This is likely due to

#  pythonx/jedi_vim.py (lines 363-379)
add_info = "preview" in vim.eval("&completeopt").split(",")
out = []
for c in completions:
    d = dict(word=PythonToVimStr(c.name[:len(base)] + c.complete),
             abbr=PythonToVimStr(c.name_with_symbols),
             # stuff directly behind the completion
             menu=PythonToVimStr(c.description),
             icase=1,  # case insensitive
             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)

How about checking here for popup as well?

davidhalter commented 1 year ago

I did not know that. 100% agreed. Can you PR this and add the default of popup as well in plugin/jedi.vim. This is much much better than the preview window.