davidhalter / jedi-vim

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

Dosctring setting is ignored when vim launched in netrw mode #1100

Closed zakutin closed 1 year ago

zakutin commented 1 year ago

Issue

When setting autocmd FileType python setlocal completeopt-=preview is set and vim is launched in netrw mode, a python file opened in a new tab will show the docstring window.

Steps to reproduce

  1. Set autocmd FileType python setlocal completeopt-=preview in .vimrc to disable docstring
  2. Launch vim . to enter netrw directory listing
  3. locate and open a python file in netrw explorer
  4. Type something for autocompletion
  5. The docstring is visible

Expected behavior

The docstring window shall not be visible.

Output of “:verbose JediDebugInfo”

#### Jedi-vim debug information ##### jedi-vim version - jedi-vim git version: be483a2 - jedi git submodule status: fae26fa7a427b94a21e11500503d8008647e6309 pythonx/jedi (v0.18.1) - parso git submodule status: ee5edaf22ff3941cbdfa4efd8cb3e8f69779fd56 pythonx/parso (v0.8.3) ##### Global Python Using Python version 3 to access Jedi. - global sys.executable: `/usr/bin/python3` - global sys.version: `3.11.1 (main, Dec 7 2022, 00:00:00) [GCC 12.2.1 20221121 (Red Hat 12.2.1-4)]` - global site module: `/usr/lib64/python3.11/site.py` ##### Jedi - path: `/home/name/.vim/plugged/jedi-vim/pythonx/jedi/jedi/__init__.py` - version: 0.18.1 ##### Jedi environment: - executable: /usr/bin/python3 - sys_path: - `/usr/lib64/python311.zip` - `/usr/lib64/python3.11` - `/usr/lib64/python3.11/lib-dynload` - `/home/name/.local/lib/python3.11/site-packages` - `/usr/lib64/python3.11/site-packages` - `/usr/lib/python3.11/site-packages` ##### Known environments ##### Settings ``` g:jedi#popup_on_dot = 0 (default: 1) g:jedi#use_tabs_not_buffers = 1 (default: 0) g:jedi#show_call_signatures = '2' (default: 1) omnifunc=jedi#completions Last set from ~/.vim/plugged/jedi-vim/autoload/jedi.vim line 723 completeopt=menuone,longest,popup Last set from ~/.vim/plugged/jedi-vim/plugin/jedi.vim line 38 ``` #### :version ``` VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Dec 14 2022 00:00:00) Included patches: 1-1054 Modified by Compiled by Huge version without GUI. Features included (+) or not (-): +autochdir +cursorshape +iconv +mouse_dec +printer -tag_old_static +visualextra -autoservername +dialog_con +insert_expand +mouse_gpm +profile -tag_any_white +vreplace -balloon_eval +diff +ipv6 -mouse_jsbterm -python -tcl +wildignore +balloon_eval_term +digraphs +job +mouse_netterm +python3/dyn +termguicolors +wildmenu -browse -dnd +jumplist +mouse_sgr +quickfix +terminal +windows ++builtin_terms -ebcdic +keymap -mouse_sysmouse +reltime +terminfo +writebackup +byte_offset +emacs_tags +lambda +mouse_urxvt +rightleft +termresponse -X11 +channel +eval +langmap +mouse_xterm +ruby/dyn +textobjects -xfontset +cindent +ex_extra +libcall +multi_byte +scrollbind +textprop -xim -clientserver +extra_search +linebreak +multi_lang +signs +timers -xpm -clipboard -farsi +lispindent -mzscheme +smartindent +title -xsmp +cmdline_compl +file_in_path +listcmds +netbeans_intg +sodium -toolbar -xterm_clipboard +cmdline_hist +find_in_path +localmap +num64 -sound +user_commands -xterm_save +cmdline_info +float +lua/dyn +packages +spell +vartabs +comments +folding +menu +path_extra +startuptime +vertsplit +conceal -footer +mksession +perl/dyn +statusline +vim9script system vimrc file: "/etc/vimrc" user vimrc file: "$HOME/.vimrc" 2nd user vimrc file: "~/.vim/vimrc" user exrc file: "$HOME/.exrc" defaults file: "$VIMRUNTIME/defaults.vim" fall-back for $VIM: "/usr/share/vim" Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=f ormat-security -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/ redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -D_FILE_OFFSET_BI TS=64 -DSYS_VIMRC_FILE=/etc/vimrc -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 Linking: gcc -Wl,--enable-new-dtags -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rp m/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs =/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes -L/usr/local/lib -o vim -lm -lse linux -lncurses -lsodium -lacl -lattr -lgpm -Wl,--enable-new-dtags -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat -hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/r edhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -fstack-protector-strong -L/usr/local/lib -L/usr/ lib64/perl5/CORE -lperl -lpthread -lresolv -ldl -lm -lcrypt -lutil -lc ``` #### :messages ``` Messages maintainer: Bram Moolenaar E475: Invalid argument: @+> VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Dec 14 2022 00:00:00) ```
:scriptnames ``` 1: /etc/vimrc 2: /usr/share/vim/vim90/syntax/syntax.vim 3: /usr/share/vim/vim90/syntax/synload.vim 4: /usr/share/vim/vim90/syntax/syncolor.vim 5: /usr/share/vim/vim90/colors/lists/default.vim 6: /usr/share/vim/vim90/filetype.vim 7: /usr/share/vim/vimfiles/ftdetect/stp.vim 8: /usr/share/vim/vim90/syntax/python.vim 9: /usr/share/vim/vim90/ftplugin.vim 10: ~/.vimrc 11: ~/.vim/autoload/plug.vim 12: /usr/share/vim/vim90/ftoff.vim 13: ~/.vim/plugged/vim-polyglot/filetype.vim 14: ~/.vim/plugged/vim-polyglot/autoload/polyglot/init.vim 15: ~/.vim/plugged/vim-polyglot/ftdetect/polyglot.vim 16: /usr/share/vim/vim90/indent.vim 17: /usr/share/vim/vim90/syntax/nosyntax.vim 18: ~/.vim/plugged/vim-polyglot/syntax/python.vim 19: ~/.vim/plugged/jedi-vim/after/syntax/python.vim 20: ~/.vim/plugged/jedi-vim/autoload/jedi.vim 21: ~/.vim/plugged/onedark.vim/colors/onedark.vim 22: ~/.vim/plugged/onedark.vim/autoload/onedark.vim 23: ~/.vim/plugged/lightline.vim/plugin/lightline.vim 24: ~/.vim/plugged/jedi-vim/plugin/jedi.vim 25: ~/.vim/plugged/vim-polyglot/plugin/polyglot.vim 26: /usr/share/vim/vim90/macros/matchit.vim 27: /usr/share/vim/vim90/pack/dist/opt/matchit/plugin/matchit.vim 28: /usr/share/vim/vim90/plugin/getscriptPlugin.vim 29: /usr/share/vim/vim90/plugin/gzip.vim 30: /usr/share/vim/vim90/plugin/logiPat.vim 31: /usr/share/vim/vim90/plugin/manpager.vim 32: /usr/share/vim/vim90/plugin/matchparen.vim 33: /usr/share/vim/vim90/plugin/netrwPlugin.vim 34: /usr/share/vim/vim90/plugin/rrhelper.vim 35: /usr/share/vim/vim90/plugin/spellfile.vim 36: /usr/share/vim/vim90/plugin/tarPlugin.vim 37: /usr/share/vim/vim90/plugin/tohtml.vim 38: /usr/share/vim/vim90/plugin/vimballPlugin.vim 39: /usr/share/vim/vim90/plugin/zipPlugin.vim 40: ~/.vim/plugged/jedi-vim/ftplugin/python/jedi.vim 41: /usr/share/vim/vim90/ftplugin/python.vim 42: ~/.vim/plugged/jedi-vim/after/ftplugin/python/jedi.vim 43: ~/.vim/plugged/vim-polyglot/indent/python.vim 44: /usr/share/vim/vim90/indent/python.vim 45: ~/.vim/plugged/lightline.vim/autoload/lightline.vim 46: ~/.vim/plugged/lightline.vim/autoload/lightline/tab.vim 47: ~/.vim/plugged/lightline.vim/autoload/lightline/colorscheme/one.vim 48: ~/.vim/plugged/lightline.vim/autoload/lightline/colorscheme.vim ```
davidhalter commented 1 year ago

You forgot to fill out the form when creating the issue. We don't have enough information to debug your issue. Since you have ignored it, I'm closing this issue, because the form is there for a reason. It saves us a lot of time and questions.

We are happy to reopen this issue if you add the necessary debug information (just click the New Issue Button and you'll find it there).

zakutin commented 1 year ago

@davidhalter, updated.

Just for record, the same happens also in vim 8.2 (see details of JediDebugInfo here)

I also noticed the following, the Settings section in JediDebugInfo looks different:

for command vim test.py

g:jedi#popup_on_dot = 0 (default: 1)
g:jedi#use_tabs_not_buffers = 1 (default: 0)
g:jedi#show_call_signatures = '2' (default: 1)

  omnifunc=jedi#completions
        Last set from ~/.vim/plugged/jedi-vim/autoload/jedi.vim line 723
  completeopt=menuone,longest,popup
        Last set from ~/.vim/plugged/jedi-vim/plugin/jedi.vim line 38

and for vim .

g:jedi#popup_on_dot = 0 (default: 1)
g:jedi#use_tabs_not_buffers = 1 (default: 0)
g:jedi#show_call_signatures = '2' (default: 1)

  omnifunc=
  completeopt=menuone,longest,popup
        Last set from ~/.vim/plugged/jedi-vim/plugin/jedi.vim line 38
davidhalter commented 1 year ago

That's kind of interesting, but most people tend to open a Python file before they start the debug command. I'll definitely try to remember this one though.

Will look at the actual issue later. Thanks for updating.

davidhalter commented 1 year ago

This is probably related to the lazy initialization of jedi-vim with jedi#auto_vim_configuration = 1. I feel like you should probably disable that for your use case and set the attributes yourself.

At the same time I like the lazy initialization in general and probably won't change it, so I'm closing. jedi#auto_vim_configuration has always been a weird setting for people that are more proficient around VIM configs.

zakutin commented 1 year ago

Thanks! The option let g:jedi#auto_vim_configuration = 0 made it.