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

Cannot get completion to work with Python #1909

Closed
robertsawko opened this issue Jan 15, 2016 · 5 comments
Closed

Cannot get completion to work with Python #1909

robertsawko opened this issue Jan 15, 2016 · 5 comments

Comments

@robertsawko
Copy link

Hi,

I am reading about Jedi integration with YCM for completion and for everyone this seems to be working out of the box. Alas, not for me!

I can confirm that set filetype? results in python. My configuration is pretty minimal

"YCM config
"let g:ycm_filetype_whitelist = { 'cpp' : 1, 'python' : 1 }
"let g:ycm_filetype_blacklist = { 'vim' : 1, 'text' : 1 }
"let g:ycm_filetype_specific_completion_to_disable = { 'python': 1  }
"let g:ycm_confirm_extra_conf = 0
let g:ycm_autoclose_preview_window_after_completion=1
nnoremap <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>

I normally work with other let lines uncommented. Finally, the :YcmCompleter command ends up with:

ValueError: Supported commands are:                                                                
GoToDefinition                                                                                     
GoToDeclaration                                                                                    
GoTo

and I can confirm that the go-tos work fine, but not the completion. The minimal example with which I am working is:

from numpy import arange                                                                       
x = arange(10)  
x.sha... # Hitting <Ctrl+N> to force YCM

where I am expecting shape to appear.

How can I check that Jedi has been selected? Should I be worried about this ValueError? Is there anything specific I need to configure to get good Python completion, ideally for function parameter names too.

@micbou
Copy link
Collaborator

micbou commented Jan 15, 2016

How can I check that Jedi has been selected?

If :YcmCompleter returns a list of commands, it means YCM is using Jedi. You can also type the :YcmDebugInfo command and check if the JediHTTP server is running.

Should I be worried about this ValueError?

No, this is proper behavior when no parameter is given to :YcmCompleter.

Concerning your example, Jedi has some issue to complete Numpy functions. YCM cannot do anything about it. However, you may also experience some timeout issue. If you often get the following message in the status line:

HTTPConnectionPool(host='127.0.0.1', port=44642): Read timed out. (read timeout=0.5)

you can increase the value of TIMEOUT_SECONDS in python/ycm/client/completion_request.py.

@robertsawko
Copy link
Author

Thanks, yes, now I see that my problem may be numpy related. For instance I get completion on

x = [1, 2, 3]
x.app # Don't even have to press anything

where append pops up as expected. Yay. But that's really a shame as numpy and scipy completions are the ones for which I yearn most.

Ah, yes, I forgot that :YcmCompleter is really a prefix to other commands. It's YcmDebugInfo I was after. The output is

Printing YouCompleteMe debug information...                                                        
-- Server has Clang support compiled in: True                                                      
-- Clang version: clang version 3.7.0 (tags/RELEASE_370/final)                                     
--                                                                                                 
-- Server running at: http://127.0.0.1:54261                                                       
-- Server process ID: 6350                                                                         
-- Server logfiles:                                                                                
--   /tmp/ycm_temp/server_54261_stdout.log                                                         
--   /tmp/ycm_temp/server_54261_stderr.log

So there's clang but no Jedi!

Increasing TIMEOUT_SECONDS didn't change anything.

@micbou
Copy link
Collaborator

micbou commented Jan 15, 2016

Did you update YCM to the latest version? JediHTTP informations in :YcmDebugInfo will only appear in recent versions.

Increasing TIMEOUT_SECONDS didn't change anything.

This is useful only if you get timeouts from YCM. It will not help for completing Numpy functions.

@robertsawko
Copy link
Author

You're right, I just updated everything and I am getting

Printing YouCompleteMe debug information...                                                                                                        
-- Server has Clang support compiled in: True                                                                                                      
-- Clang version: clang version 3.7.0 (tags/RELEASE_370/final)                                                                                     
-- JediHTTP running at 127.0.0.1:60591                                                                                                             
--   stdout log: /tmp/ycm_temp/jedihttp_60591_stdout.log                                                                                           
--   stderr log: /tmp/ycm_temp/jedihttp_60591_stderr.log                                                                                           
-- Server running at: http://127.0.0.1:37356                                                                                                       
-- Server process ID: 10213                                                                                                                        
-- Server logfiles:                                                                                                                                
--   /tmp/ycm_temp/server_37356_stdout.log                                                                                                         
--   /tmp/ycm_temp/server_37356_stderr.log 

And the numpy example still doesn't complete. Now, I think, we're confident that Jedi is working. Does this close the issue on YCM side?

@micbou
Copy link
Collaborator

micbou commented Jan 15, 2016

I think so. Let us know if you have other issues.

@micbou micbou closed this as completed Jan 15, 2016
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants