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

g:jedi#popup_select_first = 0 did not affect #179

Closed
heavenshell opened this issue Sep 3, 2013 · 23 comments
Closed

g:jedi#popup_select_first = 0 did not affect #179

heavenshell opened this issue Sep 3, 2013 · 23 comments

Comments

@heavenshell
Copy link
Contributor

Hi.

When I set vimrc like following, popup always selected first item.

set completeopt=menu
let g:jedi#popup_on_dot = 1
let g:jedi#popup_select_first = 0

I do not want to select first item.

Is there any settings for not select first item?

env

MacOS 10.8.4
Python 2.7.5
Vim 7.4.000(MacVim)

Regards,

@heavenshell
Copy link
Contributor Author

Before 3934359 works fine(Not selected first item).
After dd426c6 not fine(Selected first item).

@davidhalter
Copy link
Owner

3934359 is the first commit that doesn't work?

@heavenshell
Copy link
Contributor Author

ah, sorry for confusing you.

In 3934359

let g:jedi#popup_select_first = 0

works fine. Popup not selected first item.
But,

let g:jedi#popup_select_first = 1

not works fine. Popup not selected first item.

Anyway, latest commit always selected first item.

Regards,

@spang
Copy link

spang commented Sep 6, 2013

I can confirm this bug on Linux.

@heavenshell
Copy link
Contributor Author

diff --git a/autoload/jedi.vim b/autoload/jedi.vim
index 8b7f8bf..dfbb099 100644
--- a/autoload/jedi.vim
+++ b/autoload/jedi.vim
@@ -185,11 +185,10 @@ endfunction


 function! jedi#complete_opened()
-    if pumvisible() && g:jedi#popup_select_first && stridx(&completeopt, 'longest') > -1
-        " only go down if it is visible, user-enabled and the longest option is set
-        return "\<Down>"
+    if pumvisible() && g:jedi#popup_select_first
+        return ""
     end
-    return ""
+    return "\<C-P>"
 endfunction

I don't know this patch is correct way to fix but it seems fine.

let g:jedi#popup_select_first = 0

not select first item.

let g:jedi#popup_select_first = 1

select first item.

I can't understand about comparing stridx(&completeopt, 'longest') > -1.
(Sorry for my misunderstanding...)
In my Vim complteopts always set -1 even if i set set completeopt=longest in my .vimrc.

@davidhalter what do you think?

Best regards,

@davidhalter
Copy link
Owner

@spang which VIM version do you use?

@heavenshell what does your set completeopt say?

@heavenshell
Copy link
Contributor Author

@davidhalter Thank you for your reply.

I set set completeopt=menu in .vimrc

When I start vim $ vim sample.py
:set completeopt shows completeopt=menu

Than I input like following,

import os
os.

After popup shows and cancel popup, :set completeopt shows completeopt=menuone

my vimrc jedi.vim settings are following.

set completeopt=menu
let g:jedi#auto_initialization = 1
let g:jedi#popup_on_dot = 1
let g:jedi#show_call_signatures = 0
let g:jedi#auto_vim_configuration = 0
let g:jedi#popup_select_first = 0

Best regards,

@davidhalter
Copy link
Owner

Well, completeopt without longest is not the default of Jedi, I guess that's why that one is not working. I have to look into it again - I'm not exactly sure how it should behave in that case.

Especially because I'm not sure what users would expect without the longest option. Why don't you have the longest option set?

@heavenshell
Copy link
Contributor Author

@davidhalter Thank you for reply.

I see completeopt=longest is default.

The reason why I did not set longest is neocomplcache.
neocomplcache is auto-complete plugin and it requires set completeopt=menuone.

IMHO popup_select_first should not influenced by completeopt setting.
completeopt=menuone jedi.vim works fine for me(except popup_select_first).

@lambdalisue
Copy link

vote 👍

I have experienced exactly same phenomenon.

Thanks for reporting the revision number which worked fine because revision can be fixed with neobundle like:

  NeoBundle "davidhalter/jedi-vim", { 'rev': '3934359'}

Hope this bug will be fixed soon :-)

@heavenshell
Copy link
Contributor Author

@lambdalisue
I set following Vim script to ~/.vim/after/ftplugin/python.vim.

if g:jedi#popup_select_first == 0
  inoremap <buffer> . .<C-R>=jedi#complete_opened() ? "" : "\<lt>C-X>\<lt>C-O>\<lt>C-P>"<CR>
endif

My Vim and latest jedi.vim(master branch) works fine.
IMO this is a workaround but it's much better than use old revision.

@lambdalisue
Copy link

Totally agree with that. I just couldn't be bothered to make a monkey patch.
Thanks for the script :-)

@copitux
Copy link

copitux commented Oct 17, 2013

I see this behaviour

It doesn't work. It selects the first item

let g:jedi#popup_select_first = 0
let g:jedi#auto_vim_configuration = 0

It works

let g:jedi#popup_select_first = 0
let g:jedi#auto_vim_configuration = 1
au FileType python setlocal completeopt-=preview " The reason to deactivate jedi#auto_vim_configuration

I try this with the first case, but the trouble persists

 function! jedi#complete_opened()
     if pumvisible() && g:jedi#popup_select_first && stridx(&completeopt, 'longest') > -1
         " only go down if it is visible, user-enabled and the longest option is set
-       return "\<Down>"
+       return ""
     end
     return ""
 endfunction

I use Shougo/neocomplete

tony added a commit to tony/vim-config-framework that referenced this issue Dec 12, 2013
@icook
Copy link

icook commented Dec 25, 2013

Using YouCompleteMe the problem persists even when trying the above suggestions, although I might be missing something silly...

This is enough of a thorn in my side I've been forced to disable Jedi for now, would be great to see a patch.

@m-novikov
Copy link

YouCompleteMe already has bundled jedi, you dont need jedi-vim for autocomplete in this case.
And also YouCompleteMe(YCM) forces set completeopt-=longest YCM longest which breaks jedi-vim.

@davidhalter
Copy link
Owner

It doesn't break jedi-vim. Or at least it shouldn't but I'm not sure if the two are compatible.

@m-novikov
Copy link

I meant that causes jedi-vim to always select first item in completion list, i disable completions in jedi-vim and use its other features, while YCM handles completions.
YCM sets completeopt-=longest every time completion happens.

@polyrabbit
Copy link

If you have both jedi-vim and neocomplcache enabled, the solution from @Shougo may help.
see #258

@davidhalter
Copy link
Owner

So what's the remaining issue in jedi-vim here? I don't really understand.

@copitux

let g:jedi#popup_select_first = 0
let g:jedi#auto_vim_configuration = 0

It doesn't surprise me that this doesn't work, because you're disabling the automatic configuration.

@heavenshell
Copy link
Contributor Author

I still have problem even though let g:jedi#auto_vim_configuration = 1.

let g:jedi#auto_initialization = 1
let g:jedi#popup_on_dot = 1
let g:jedi#show_call_signatures = 0
let g:jedi#auto_vim_configuration = 1
let g:jedi#popup_select_first = 0

@davidhalter
Copy link
Owner

@blueyed has changed something in the implementation of popup_select_first, could you retry?

@heavenshell
Copy link
Contributor Author

@davidhalter Sorry for late reply.
Greate, works fine!

@blueyed
Copy link
Collaborator

blueyed commented May 16, 2015

Thanks for repporting back.
Closing.

@blueyed blueyed closed this as completed May 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants