Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PlugUpdate and delayed loading not always playing nicely together #272

Closed
montefra opened this issue Aug 25, 2015 · 10 comments
Closed

PlugUpdate and delayed loading not always playing nicely together #272

montefra opened this issue Aug 25, 2015 · 10 comments
Assignees
Labels

Comments

@montefra
Copy link

While exploring an issue with the jedi-vim plugin I encountered a possible bug:

In my .vimrc I add jedi as:

Plug 'davidhalter/jedi-vim', { 'for':  'python' }

If I open a vim session and do:

  1. PlugUdate
  2. open a python file

the popup with the function/class/... signature looks very messy (see the screenshots in the above link, all the ==jedi=0, == should not be there). But it works without issues if I open it in a session where PlugUpdate has not been run.

If I don't delay the loading:

Plug 'davidhalter/jedi-vim'

and repeat the above exercise, then the pop up looks fine.

My guess is that the reload at the end of PlugUpdate might not play very well with not jet loaded plugins.

@blueyed
Copy link
Contributor

blueyed commented Aug 25, 2015

That might be related to the syntax handling (via after), which is supposed to setup the concealing: https://github.com/davidhalter/jedi-vim/blob/master/after/syntax/python.vim

@starcraftman
Copy link
Contributor

@montefra I can't reproduce this bug. I used a fresh user, with no extising ~/.vim folder and my vimrc is below. Then the steps:

  • Open Vim
  • PlugInstall
  • Restart Vim
  • PlugUpdate
  • Open a python file

At the end completion seemed fine, definitely didn't see your ugly line. Can someone else test, am I missing something? I'm on Ubuntu btw, original bug reporter seemed to imply he found it broke on Mint.

set nocompatible
filetype plugin indent on
silent !mkdir --parents ~/.vim/autoload
silent !curl --fail --location --output ~/.vim/autoload/plug.vim https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

call plug#begin('~/.vim/plugged')
Plug 'davidhalter/jedi-vim', { 'for':  'python' }
call plug#end()

@montefra
Copy link
Author

I'm on Kubuntu 15.04 with vim 7.4 Included patches: 1-488

@starcraftman: I've just created a new user and tested vim with only your .vimrc and I still see the problem.
On my laptop I also have opensuse tumbleweed installed: as soon as I reboot, I'll test also there.

@blueyed: ok. But why doesn't work if I run PlugUpdate and have the delayed loading, but has no problems if I don't run the command or remove the { 'for': 'python' }?

@starcraftman
Copy link
Contributor

@montefra I used vagrant to test your setup, namely 15.04 with vim 7.4.488. I still can't replicate. Can you try these steps exactly and report if you still get bug. At the end of these steps, I get what you see in screenshot at bottom.

This will provision the same test env I just tried on a given host machine. Uses vagrant & virtualbox for virtualization, ensure you have no Vagrantfile in current directory.

sudo apt-get install vagrant virtualbox
vagrant box add vivid https://github.com/kraksoft/vagrant-box-ubuntu/releases/download/15.04/ubuntu-15.04-amd64.box
vagrant init vivid
vagrant up
vagrant ssh

Once SSHed, copy the contents of below vimrc to ~/.vimrc and continue:

sudo apt-get install git vim
vim +PlugInstall +qa
vim
:PlugUpdate
** push q to close plug buffer **
:e file.py
** use completion **
set nocompatible
filetype plugin indent on
silent !mkdir --parents ~/.vim/autoload
silent !curl --fail --location --output ~/.vim/autoload/plug.vim https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
call plug#begin('~/.vim/plugged')
Plug 'davidhalter/jedi-vim', { 'for':  'python' }
call plug#end()

All these steps get me:
pssave1

@starcraftman starcraftman self-assigned this Aug 26, 2015
@montefra
Copy link
Author

@starcraftman : thanks for the effort.
However the problem is not on the pop up that appears after dots, but the one that appears to show function/class/... signatures (as shown in the screenshots in the original issue).

Can you please check what happens if you type len( in a python file (also a new one)?

The correct behavior is (the first line is the jedi popup with the function signature):

  1    (object) 
  2 len(

If I run PlugUdate before I get this instead:

 1 =`=jedi=0, =`=   (*_*object*_*) =`=jedi=`=
 2 len(

If you can't reproduce the issue this way, I'll go through the virtualbox test.

@junegunn
Copy link
Owner

@starcraftman Thanks for looking into this. I can reproduce the len( problem on the virtualbox image and I narrowed down the problem to the extra plug#end() call. Haven't yet found time to drill down the problem. So you can reproduce just by :call plug#end() or :source ~/.vimrc without PlugInstall or Update.

vimrc:

call plug#begin('~/.vim/plugged')
Plug 'davidhalter/jedi-vim', { 'for':  'python' }
call plug#end()

@starcraftman
Copy link
Contributor

@montefra I see, the problem is just with this special python builtin completion that uses conceal on the line above current. Can reproduce with len().

@junegunn Yup, easily reproduced with plug#end() calls, saves the update hassle.

@starcraftman
Copy link
Contributor

After doing some investigating, this small patch seems to sort the problem out. The root cause of the garbage was the after/syntax/python.vim files were never sourced. I guess I'll go make a PR, seems harmless fix.

Edit: This patch does mean we will sometimes double source syntax files, but not a big issue. Is there a way around that?

diff --git a/plug.vim b/plug.vim
index 6e14d0e..9eb11fc 100644
--- a/plug.vim
+++ b/plug.vim
@@ -399,7 +399,7 @@ function! s:lod(names, types)
 endfunction

 function! s:lod_ft(pat, names)
-  call s:lod(a:names, ['plugin', 'after/plugin'])
+  call s:lod(a:names, ['plugin', 'after/plugin', 'syntax', 'after/syntax'])
   execute 'autocmd! PlugLOD FileType' a:pat
   if exists('#filetypeplugin#FileType')
     doautocmd filetypeplugin FileType

starcraftman added a commit to starcraftman/vim-plug that referenced this issue Aug 26, 2015
* Force syntax files sourcing on lod_ft.
@montefra
Copy link
Author

@starcraftman: I've temporary replaced plug.vim with you version and I confirm that now jedi works as expected.

Thanks a lot for the fix.

@starcraftman
Copy link
Contributor

@montefra No problem, happy vimming. Fix is now merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants