davidhalter / jedi-vim Goto Github PK
View Code? Open in Web Editor NEWUsing the jedi autocompletion library for VIM.
License: MIT License
Using the jedi autocompletion library for VIM.
License: MIT License
For example, this is output of help(set().difference)
:
difference(...)
Return the difference of two or more sets as a new set.
(i.e. all elements that are in this set but not the others.)
This is how jedi-vim
autocompletes the signature:
(i.e.all elements that are in this set but not the others)
set().difference(
jedi-vim
help looks like:
difference(self,
i.e.all elements that are in this set but not the others)
Return the difference of two or more sets as a new set.
(i.e. all elements that are in this set but not the others.)
It's probably my error somewhere but I cannot install jedi-vim probably because a module is not found; I get this error while doing anything on a .py file:
Error detected while processing function jedi#show_func_def:
line 1:
Traceback (most recent call last):
Press ENTER or type command to continue
Error detected while processing function jedi#show_func_def:
line 1:
File "<string>", line 1, in <module>
Press ENTER or type command to continue
Error detected while processing function jedi#show_func_def:
line 1:
NameError: name 'jedi_vim' is not defined
First I followed this guide: http://redkrieg.com/2012/12/11/writing-python-like-a-jedi/
then I tried installing the jedi module in python directly and importing jedi in python (which worked) but no difference.
I have no other settings about python in vimrc or any other modules.
Any ideas?
The README displayed at https://github.com/davidhalter/jedi-vim has broken image links for me. For example, https://github.com/davidhalter/jedi/raw/master/screenshot_complete.png is a 404. Jedi (as opposed to jedi-vim) images are ok.
P.S. Happy New Year
When trying to go to the definition of an explicitly imported method that is imported along with others, one is prompted with the following error:
Traceback (most recent call last):
File "/fastnbig/home/obreitwi/git/usualStuff/vim/bundle-git/jedi/plugin/jedi_vim.py", line 168, in show_func_def
call_def = get_script().get_in_function_call()
File "/fastnbig/home/obreitwi/git/usualStuff/vim/bundle-git/jedi/plugin/jedi_vim.py", line 38, in get_script
return jedi.Script(source, row, column, buf_path)
File "/fastnbig/home/obreitwi/usr/lib/python2.6/site-packages/jedi-0.5b3-py2.6.egg/jedi/api.py", line 173, in __init__
position=self.pos)
File "/fastnbig/home/obreitwi/usr/lib/python2.6/site-packages/jedi-0.5b3-py2.6.egg/jedi/modules.py", line 64, in __init__
self._parser = parsing.PyFuzzyParser(source, path, position)
File "/fastnbig/home/obreitwi/usr/lib/python2.6/site-packages/jedi-0.5b3-py2.6.egg/jedi/parsing.py", line 1138, in __init__
self.parse()
File "/fastnbig/home/obreitwi/usr/lib/python2.6/site-packages/jedi-0.5b3-py2.6.egg/jedi/parsing.py", line 1684, in parse
self._check_user_stmt(i)
File "/fastnbig/home/obreitwi/usr/lib/python2.6/site-packages/jedi-0.5b3-py2.6.egg/jedi/parsing.py", line 1172, in _check_user_stmt
for n in simple.get_set_vars():
AttributeError: 'Import' object has no attribute 'get_set_vars'
If only a single method is imported directly it works fine.
Steps to reproduce:
testa.py
with following content:def methoda():
pass
def methodb():
pass
from testa import methoda, methodb
methoda
or methodb
and try to go to its definition.os.path. raises vimerror
I have to fix this.
It may have to do with larger modules or modules with many dependencies causing a lot of reads. An example is a file like
import scipy.weave
scipy.weave.inline(
When the function definition is pulled up after typing that, not only is it slow to load the definition right when the open-paren is typed, but also typing each character afterwards (in the argument list) has significant lag. The issue may be solvable with caching (e.g. caching python's standard libraries into jedi-vim's internal data structures so that they don't need to be re-parsed, if that's what's happening, as well as caching whatever computation is happening when each character is typed).
It may be useful to use the profilehooks
module like this in plugin/jedi_vim.py
:
import sys
sys.stdout = open('/Users/mattjj/Desktop/blah','w')
from profilehooks import profile
@profile(immediate=True)
def show_func_def(call_def=None, completion_lines=0):
...
It looked like much of the time was spent in file I/O.
This issue may be related to #20, but it comes up when the source file being edited is very small (as above).
Probably closely related to #17.
Vim crashes with a segfault when completing sys.
import sys
sys.<tab>
The corresponding jedi completion works:
>>> jedi.Script('import sys\nsys.', 2, 4, 'test.py').complete()
[<Completion: long_info>,
...]
I just switched from pathogen to vundle. I thought that this didn't happen before, but I reverted my configuration and vim still crashes.
Hello, I just started using jedi-vim, and have bumped into some problems.
Firstly, pydoc (shift-k) isn't working for a few of the keywords (haven't tested on many).
When pressing shift-k for print, it gives:
Error detected while processing function jedi#show_pydoc:
line 22:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/home/user/.vim/bundle/jedi-vim/jedi/jedi/api_classes.py", line 73, in doc
return self.raw_doc
File "/home/user/.vim/bundle/jedi-vim/jedi/jedi/api_classes.py", line 79, in raw_doc
return str(self.definition.docstr)
File "/home/user/.vim/bundle/jedi-vim/jedi/jedi/keywords.py", line 52, in docstr
return imitate_pydoc(self.name)
File "/home/user/.vim/bundle/jedi-vim/jedi/jedi/keywords.py", line 84, in imitate_pydoc
return pydoc_topics.topics[label] if pydoc_topics else ''
KeyError: 'print'
line 34:
E121: Undefined variable: l:doc
E15: Invalid expression: l:doc
line 40:
E121: Undefined variable: l:doc_lines
E15: Invalid expression: l:doc_lines > 30 " max lines for plugin
line 43:
E121: Undefined variable: l:doc_lines
E15: Invalid expression: "resize ".l:doc_lines
shift-k on import gives:
Exception, this shouldn't happen.
Traceback (most recent call last):
File "<string>", line 4, in <module>
File "/home/user/.vim/bundle/jedi-vim/jedi/jedi/api.py", line 219, in get_definition
d = set([api_classes.Definition(s) for s in scopes])
File "/home/user/.vim/bundle/jedi-vim/jedi/jedi/api_classes.py", line 173, in __init__
super(Definition, self).__init__(definition, definition.start_pos)
AttributeError: '_GlobalNamespace' object has no attribute 'start_pos'
I then tried importing jedi in python interpreter, and it gives:
>>> import jedi
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.3/site-packages/jedi/__init__.py", line 1, in <module>
from .api import Script, NotFoundError, set_debug_function
File "/usr/lib/python3.3/site-packages/jedi/api.py", line 6, in <module>
import parsing
ImportError: No module named 'parsing'
The completion works fine though.
I am using archlinux with python 3.3.0
I installed jedi-vim using vundle and jedi using pip.
As the title says, calling jedi#complete when the buffer name is not set doesn't complete. The filetype is set to python.
For instance, if I run vim as "vim" on the command line, this doesn't complete properly:
set ft=python
set completefunc=jedi#complete
import pprint
pprint.<C-x><C-u>
On the other hand, if I run vim as "vim foo", it works as expected.
Hi. Here's a code snippet to help reproduce the issue.
#!/usr/bin/env python
class Module(object):
def __init__(self, name, url=None):
self.name = name
self.url = url
mods = [
Module('jedi-vim', url='https://github.com/davidhalter/jedi-vim'),
Module('', url='https://github.com/davidhalter/jedi-vim'),
]
another_list = []
Position the cursor to 10,12 (the first quote in the argument list of the second Module constructor in mods
. Press I to enter insert mode. Move cursor one column to the left. Instead of displaying the argument pop-up correctly, the text one line above (which should have been overlaid by the pop-up) is mangled and broken up, and all code after the cursor seems to be syntax colored as being inside quotes (i.e. as a string - note another_list being colored red). See attached screenshots for clarification. Also the current line gets pushed down one line.
Also interestingly, moving the cursor around within the parens seems to alternate showing and hiding the pop-up. If I move the cursor one line up (to the first module definition parens), it works properly.
If you launch vim from a directory containing the filename token.py (which I have in a project), then you get an error at launch and jedi-vim doesn't work.
~/dbi/intermateria/intermateria/auth (master⚡) ls
__init__.py __init__.pyc permissions.py permissions.pyc token.py token.pyc tools.py tools.pyc
~/dbi/intermateria/intermateria/auth (master⚡) vim tools.py
Error detected while processing /home/aubiebn/.vim/bundle/jedi-vim/plugin/jedi.vim:
line 72:
Traceback (most recent call last):
File "<string>", line 15, in <module>
File "/home/aubiebn/.vim/bundle/jedi-vim/plugin/jedi_vim.py", line 11, in <module>
import jedi
File "/home/aubiebn/.vim/bundle/jedi-vim/jedi/jedi/__init__.py", line 1, in <module>
from .api import Script, NotFoundError, set_debug_function
File "/home/aubiebn/.vim/bundle/jedi-vim/jedi/jedi/api.py", line 6, in <module>
import parsing
File "/home/aubiebn/.vim/bundle/jedi-vim/jedi/jedi/parsing.py", line 31, in <module>
from _compatibility import (next, literal_eval, tokenize_func, BytesIO,
File "/home/aubiebn/.vim/bundle/jedi-vim/jedi/jedi/_compatibility.py", line 73, in <module>
import tokenize
File "/usr/lib/python2.7/tokenize.py", line 38, in <module>
COMMENT = N_TOKENS
NameError: name 'N_TOKENS' is not defined
Press ENTER or type command to continue
After this, vim is full of errors whenever you type anything and thus is unusable. I can work around this by launching vim from outside of that directory.
I'm guessing that this is because you also use a file or package named "token"; however, I don't think it's unreasonable that somebody could have a file named token.py. Therefore, perhaps you could rename yours to something a little less common such as jeditoken.py?
What's the license of jedi-vim? Is it also LGPL-3+ (like Jedi)?
Could you add LGPL statements to all files? (see http://www.gnu.org/licenses/gpl-howto.html)
PS I just created Debian packages, they're not yet in Debian, but you can take a look at
http://people.debian.org/~piotr/jedi/ or http://anonscm.debian.org/viewvc/python-modules/packages/python-jedi/trunk/
Thanks!
Hey, first of all, I just want to say this is probably the most useful vim plugin I have these days.
I like to use vim with multiple buffers. When I use omni completion and the little pydoc buffer pops up, after it closes it resets the size of all my open buffers (they all become equal). I tried to do this, but my vim skills are apparently nowhere near good enough. It seems to be possible, because if I open a help buffer (:help foo) and then close it (:q), all the buffers are restored to their previous sizes.
For now I'm working around this by just not letting the pydoc buffer close (let g:jedi#auto_close_doc = 0)
thanks
As the title.
I'm using the neocomplcache, and set python omnifunc to jedi#complete
.
I find jedi always select first candidate in popup menu after I press dot .
I do not want to auto select first candidate. I try to find some options in jedi-vim plugin. But I have not found it. (I have found the settings in plugin/jedi.vim
).
When typing a string like "self." with popup-on-dot enabled, junk text gets inserted into the buffer. See these screenshots for an example; the second screenshot was taken right after typing '.' given the state shown in the first screenshot. The junk text is actually in the buffer; it persists after closing the menu.
The code for the example is
class A(object):
def foo(self):
return len(self
Just typing a dot at the end causes the error.
This vim version has conceal
; here is part of the output of vim --version
:
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jul 25 2012 23:52:55)
MacOS X (unix) version
Included patches: 1-244, 246-615
After performing a jedi-rename (leader-r), the syntax highlighting turns off. I have to turn it back on manually.
1 class Test(object):
2 def __init__(self):
3 self
↑
If you write the dot after self
, it is automatically completed to self.__init__
. So if I want to create/assign a new attribute, I first have to delete the __init__
part before being able to write the new name.
First, thank you for this great plugin. Autocompleting python code in vim has always been a pain in the neck for me. Now, the issue:
Suppose that I type building
, and try to complete it with <C-Space>
. Three options appear:
building_height
building_shadow
building_location
and it completes the word with the first option (_height
).
If I type <C-Space>
again, the right behavior should be to complete the word with the next option (_shadow
), so that I can iterate through all options.
Instead, it tries to complete the whole thing (building_height
), for which there is only one option -- itself.
Looking at the source code, I see that <C-Space>
is being mapped to <C-x><C-o>
, Vim's own completion shortcut.
When I try to complete building
with <C-x><C-o>
, the right thing happens -- I can iterate through the options using the same keys.
How could <C-Space>
be correctly mapped to behave fully like <C-x><C-o>
?
For some reason jedi#complete
gets confused by
import tarfile
tarfile.
and doesn't show any completion options.
This is Python 2.7 on Ubuntu 12.10.
When using jedi-vim with vim versions prior to 7.3 (I tested with 7.2), the function-argument completion may sometimes inject text into the actual buffer.
Steps to reproduce:
import numpy as np
np.linspace( 1, 2, 3 )
Also notice that there is no function-argument completion.
import num≡jedi=0, py as np≡ (start, stop, *num=50*, endpoint=True, retstep=False) ≡jedi≡
np.linspace( 1, 2, 3. )
The text is inserted into the buffer and will be written to disk with the next save.
My guess would be that it has something to do with the missing "conceal" feature, but I've had no time to investigate further. For the time being I simply set
let g:jedi#popup_on_dot=0
in that machine's rc-file.
If the path to the file you are trying to access via jedi-vim's go-to or go-to-definition commands contains a space (e.g., ~/Desktop/Some Stuff/test_file.py), than vim will complain because it interprets everything after the space as the filename.
The following code would not show the function definition if you go to re.compile and enter "(". If you can't reproduce the behavior please remove the line and type "re.compile(" again.
A workaround is typing "re.compile()" and then move the cursor back inside the parentheses.
I am using githubs jedi-vim and pips jedi.
#!/usr/bin/env python
# -*- coding: utf8
import re
def huhu(it):
"""Bla
blalb"""
re.compile
return it * 2
Given the following file contents
import pylab as p
fig = p.figure()
fig.add_subplot( 111 )
if I (for whatever reason) try to get the docstring of the add_subplot
method I receive the following Error, even though jedi should probably just say "Pattern not found" as it does for the dot-completion.
Exception, this shouldn't happen.
Traceback (most recent call last):
File "<string>", line 4, in <module>
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/api.py", line 336, in get_definition
scopes = set(self._prepare_goto(goto_path))
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/api.py", line 296, in _prepare_goto
scopes = evaluate.follow_statement(stmt)
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/helpers.py", line 26, in __call__
result = self.func(stmt, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 108, in wrapper
rv = function(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 1345, in follow_statement
result = follow_call_list(call_list)
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 1424, in follow_call_list
result += follow_call(call)
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 1439, in follow_call
return follow_call_path(path, scope, position)
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 1462, in follow_call_path
search_global=True)
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 1214, in get_scopes_for_name
return descriptor_check(remove_statements(filter_name(scope_generator)))
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 1023, in remove_statements
scopes = follow_statement(r, seek_name=name_str)
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/helpers.py", line 26, in __call__
result = self.func(stmt, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 108, in wrapper
rv = function(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 1345, in follow_statement
result = follow_call_list(call_list)
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 1424, in follow_call_list
result += follow_call(call)
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 1439, in follow_call
return follow_call_path(path, scope, position)
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 1469, in follow_call_path
return follow_paths(path, result, position=position)
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 1484, in follow_paths
fp = follow_path(iter_paths[i], r, position=position)
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 1531, in follow_path
return follow_paths(path, set(result), position=position)
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 1484, in follow_paths
fp = follow_path(iter_paths[i], r, position=position)
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 1517, in follow_path
result = Execution(scope, current).get_return_types()
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 108, in wrapper
rv = function(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/helpers.py", line 103, in __call__
result = self.func(execution, evaluate_generator)
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 522, in get_return_types
stmts = self._get_function_returns(evaluate_generator)
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 539, in _get_function_returns
stmts += follow_statement(r)
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/helpers.py", line 26, in __call__
result = self.func(stmt, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 108, in wrapper
rv = function(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 1345, in follow_statement
result = follow_call_list(call_list)
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 1424, in follow_call_list
result += follow_call(call)
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 1439, in follow_call
return follow_call_path(path, scope, position)
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 1462, in follow_call_path
search_global=True)
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 1214, in get_scopes_for_name
return descriptor_check(remove_statements(filter_name(scope_generator)))
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 1130, in filter_name
for nscope, name_list in scope_generator:
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 946, in get_names_for_scope
position, in_func_scope)
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 907, in get_defined_names_for_position
names = scope.get_defined_names()
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 696, in get_defined_names
return self.get_params() + parsing.Scope.get_set_vars(self)
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 108, in wrapper
rv = function(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/evaluate.py", line 582, in get_params
param_dict[str(param.get_name())] = param
File "/usr/local/lib/python2.7/dist-packages/jedi-0.5b3-py2.7.egg/jedi/parsing.py", line 841, in get_name
return n[0]
IndexError: list index out of range
When tried "pip install jedi" on ubuntu 12.04 x86_64, throws syntax error and other warning.
sandeep@sandeep-OptiPlex-755:~/python_play$ sudo pip install jedi --upgrade
Downloading/unpacking jedi
Running setup.py egg_info for package jedi
package init file 'jedi/mixin/__init__.py' not found (or not a regular file)
warning: no previously-included files matching '*.pyc' found under directory '*'
Installing collected packages: jedi
Found existing installation: jedi 0.5b3
Uninstalling jedi:
Successfully uninstalled jedi
Running setup.py install for jedi
package init file 'jedi/mixin/init.py' not found (or not a regular file)
SyntaxError: ('invalid syntax', ('/usr/local/lib/python2.7/dist-packages/jedi/mixin/_functools.py', 9, 42, ' return self.__func(_self.__args, *args, *_self.keywords, **kwargs)\n'))
warning: no previously-included files matching '*.pyc' found under directory '*'
Successfully installed jedi
Cleaning up...
When I try to invoke a Python function by typing its name and the opening parens, a little pop up appears showing me the function arguments. If I then exit insert mode by pressing control+c, the pop up remains on screen, instead of disappearing like if I exit using Escape. If I go up one line (where the pop-up is), that line will become garbled, as in the attached screenshot.
jedi-vim crashes when writing such an expression:
for sth in sorted(
Error detected while processing function jedi#show_func_def:
Traceback (most recent call last):
Error detected while processing function jedi#show_func_def:
File "", line 1, in
Error detected while processing function jedi#show_func_def:
File "/usr/lib/python2.7/site-packages/jedi/api.py", line 434, in get_in_function_call
Error detected while processing function jedi#show_func_def:
origins = evaluate.follow_call(call)
Error detected while processing function jedi#show_func_def:
File "/usr/lib/python2.7/site-packages/jedi/evaluate.py", line 1431, in follow_call
Error detected while processing function jedi#show_func_def:
return follow_call_path(path, scope, position)
Error detected while processing function jedi#show_func_def:
File "/usr/lib/python2.7/site-packages/jedi/evaluate.py", line 1454, in follow_call_path
Error detected while processing function jedi#show_func_def:
search_global=True)
Error detected while processing function jedi#show_func_def:
File "/usr/lib/python2.7/site-packages/jedi/evaluate.py", line 1206, in get_scopes_for_name
Error detected while processing function jedi#show_func_def:
return descriptor_check(remove_statements(filter_name(scope_generator)))
Error detected while processing function jedi#show_func_def:
File "/usr/lib/python2.7/site-packages/jedi/evaluate.py", line 1128, in filter_name
Error detected while processing function jedi#show_func_def:
Error detected while processing function jedi#show_func_def:
File "/usr/lib/python2.7/site-packages/jedi/evaluate.py", line 929, in get_names_for_scope
Hey, I installed jedi-vim and it's working, it's triggering when I type . for example. But Ctrl+Space doesn't do anything, just inserts a space character into the buffer. ctrl-x ctrl-o seems to trigger jedi autocompletion. Do I have to do something to get ctrl-space?
When I install the plugin and open a file in python + - 400 lines, when it gets slow when I start typing. And when I type the point, it takes about 2 seconds to appear oa listing.
Remembering that this was a project in Django.
from @gilsondev (in another issue)
(this issue is discussed here: davidhalter/jedi#34 it's just here to avoid duplicate posts)
I guess this happens with other functions, too, but I just saw it when calling list.append()
. The first parameter is self
, the second one object
.
First of all kudos for writing such a nice plugin. I am facing a couple of problems may be you can help.
I used pathogen to install jedi-vim and placed it in .vim/bundle directory and now I am observing that my vim load time has increased significantly. My vim takes around 4-5 secs to load. I already tried disabling the auto-initialization of jedi-vim but no effect.
The other problem am facing is I have disabled the automatic completion feature(str.) but according to the docs to use the auto-complete feature one should use Ctrl+Space but when I try to use this key binding what vim does is it copies the text. For example
import urllib. + <ctrl+space> becomes import urllib.import urllib
I profiled vim start-up using vim --startuptime vim.log test.py and here is the output http://sprunge.us/LTGW. If I understand correctly jedi.vim takes a lot of time while sourcing
4565.741 3994.576 3994.576: sourcing /home/ranveer/.vim/bundle/jedi-vim/plugin/jedi.vim
I am using ubuntu 12.04 on my netbook and my vim version is 7.3
Hi,
the go to/go to definition command hasn't been very reliable for me. For example, if I check out the newest Gunicorn from github, and then open up (f.e.) gunicorn/arbiter.py, highlight "HaltServer" on line 16 and press g/d, I'll get the 'Can't find any definitions for this.' message after about 2-3 seconds pause.
Let me preface this by first thanking you for this plugin. I have been looking for decent python-completion for quite a while now.
That being said, I am having some trouble when dealing with renamed imports:
For instance, opening an new file and writing "import subprocess as" will produce the following traceback:
Error detected while processing function jedi#show_func_def:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/obreitwi/git/usualStuff/vim/bundle-git/jedi/plugin/jedi_vim.py", line 38, in get_script
return jedi.Script(source, row, column, buf_path)
File "/usr/lib/python2.7/site-packages/jedi-0.5b3-py2.7.egg/jedi/api.py", line 173, in __init__
position=self.pos)
File "/usr/lib/python2.7/site-packages/jedi-0.5b3-py2.7.egg/jedi/modules.py", line 64, in __init__
self._parser = parsing.PyFuzzyParser(source, path, position)
File "/usr/lib/python2.7/site-packages/jedi-0.5b3-py2.7.egg/jedi/parsing.py", line 1138, in __init__
self.parse()
File "/usr/lib/python2.7/site-packages/jedi-0.5b3-py2.7.egg/jedi/parsing.py", line 1646, in parse
imports = self._parseimportlist()
File "/usr/lib/python2.7/site-packages/jedi-0.5b3-py2.7.egg/jedi/parsing.py", line 1251, in _parseimportlist
name2, token_type, tok = self._parsedotname()
ValueError: too many values to unpack
Trying to view the docstring via pydoc for the line "import subprocess as sp" then also yields the following error:
Error detected while processing function jedi#show_pydoc:
line 22:
Traceback (most recent call last):
File "<string>", line 11, in <module>
NameError: name 'traceback' is not defined
line 34:
E121: Undefined variable: l:doc
E15: Invalid expression: l:doc
line 40:
E121: Undefined variable: l:doc_lines
E15: Invalid expression: l:doc_lines > 30 " max lines for plugin
line 43:
E121: Undefined variable: l:doc_lines
E15: Invalid expression: "resize ".l:doc_lines
So, I tested jedi-vim
on windows using GVim because console vim doesn't have python support by default.
Here are my observation for some built-in modules:
Vim has stopped working
but we all know that we can't trust windows on this issue because may be it will work fine on another windows installation.Builtin module nt
So, we can say that jedi-vim
worked fine on windows without running into any major issues except the sys
one.
To use jedi-vim with console-vim
one must compile vim with python support. Here are two similar guides for doing that:
I don't actually know the exact difference between get_definition and goto, but I'm pretty sure this isn't supposed to be it. :)
Using the Gunicorn git repo:
vim gunicorn/http/wsgi.py
position cursor on line 13, SERVER_SOFTWARE
symbol
invoke goto
: works
invoke get_definition
:
Error detected while processing function jedi#get_definition:
line 1:
E121: Undefined variable: u
E116: Invalid arguments for function setqflist([{'text': u'Builtin class str'}, {'text': u'Builtin cla
ss str'}])
E15: Invalid expression: setqflist([{'text': u'Builtin class str'}, {'text': u'Builtin class str'}])
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/tin/.vim/bundle/jedi-vim/plugin/jedi_vim.py", line 150, in goto
vim.eval('setqflist(%s)' % str(lst))
vim.error: invalid expression
If I type 0.1 then after auto-completion I actually get
0.__init__1
I was writing the following code:
@contextmanager
def cd(directory):
"""Change the current working directory, temporarily.
Use as a context manager: with cd(d): ...
"""
and got the completion popup as soon as I pressed .
. The popup didn't go away as I completed the ...
.
Suggestion: do not open the popup if the character in front of the .
is a space or another .
. Or a digit, for that matter.
Hi!
Please add python3/dyn support.
My vim (Vi IMproved 7.3 (2010 Aug 15, compiled Dec 16 2012 13:15:28)) compiled with '+python3/dyn -python' (Arch linux).
It complains: "Error: Required vim compiled with +python".
Thanks!
When typing, fast, the automatic completion when typing . automatically inserts the first match and puts the cursor behind the match. So, consider for example typing the following:
from optparse import OptionParser
parser = OptionParser()
parser.
When typing the final . the popup opens and automatically insers _add_help_option
, which is unlikely what you want. You end up with the cursor behind this member. To illustrate this, I'll use a *
to denote the cursor position:
from optparse import OptionParser
parser = OptionParser()
parser._add_help_option*
I then have to hit backspace to remove the text again up to the . character. Which is really annoying.
At least for me, this completely destroys the usefulness of the auto-popup.
On Mountain Lion, using MacVim snapshot 65 and the latest jedi-vim.
Pressing 'K' over an imported module results in:
:! man 'cookielib'
No manual entry for cookielib
shell returned 1
Running setkeywordprg results in:
keywordprg=man -s
I get an uncaught exception in jedi#show_func_def at the end of typing this string:
with open(
Possibly related to #3, but I get the exception on both master and dev branches. See this screenshot.
Yeah, this is my OCD talking, but plugin/jedi_vim.pyc just irks me when polling my git status.
Is there a way to easily rebind the autocompletion feature? For example, from control + space to shift + space? It might also be useful to put this information into the readme somewhere for VIM newbs like me :)
I may not be experienced enough with vim's autocomplete, but I'm trying to use the popup_on_dot feature but it does nothing except slow me down. If I want:
myObj.zebra()
Then I seem to HAVE to scroll to zebra (using arrow keys or C+p/C+n). If I just type a z after the . then I get
myObj.__init__z
Is there a way to avoid this?
On switching virtualenv/interpreter do reinitialize python stuff.
When I start vim, jedi use system python interpreter
But I used VirutalEnv vim plugin for switching per project.
I have many projects in tabs for one vim instance.
To solve this issue I wrote simple function for reimporting jedi lib and jedi_vim files in new virtualenv
Sorry for my poor English (
As mentioned in davidhalter/jedi#101:
Completing gobject via jedi in Python console works. But vim doesn't show anything.
Here's :messages
after enabling debugging:
speed: init 8.39233398438e-05
speed: func_call start 0.000213861465454
speed: init 0.000136852264404
speed: complete start 0.000208854675293
dbg: start: gobject in <Module: test@1-None>
speed: parsed 0.0024619102478
dbg: follow_stmt <Statement: gobject @3> (None)
dbg: calls: <Array: noarray[[<Call: gobject>]]>
dbg: sfn filter "gobject" in <Module: test@1-None>: [<Import: import gobject @1>]
dbg: sfn remove, new: [<Import: import gobject @1>], old: [<Import: import gobject @1>]
dbg: follow_module, None, gobject
dbg: search_module, gobject, /home/danilo/.dotfiles/.vim/bundle/jedi-vim/jedi
warning: Module not found: <Import: import gobject @1>
dbg: possible scopes, []
speed: complete end 0.0164008140564
speed: func_call start 0.0164408683777
speed: init 2.50339508057e-05
speed: func_call start 5.69820404053e-05
Does that help?
While function definitions are easy to read in console vim, I found them really hard to read in gvim (white and cyan text on grey background)
I modified locally the plugin to show black text on grey (and darker grey for the current parameter)
diff --git a/after/syntax/python.vim b/after/syntax/python.vim
index 57f1453..e10c5ca 100644
--- a/after/syntax/python.vim
+++ b/after/syntax/python.vim
@@ -14,8 +14,8 @@ if g:jedi#show_function_definition == 1 && has('conceal')
hi def link jediIgnore Ignore
hi def link jediFatSymbol Ignore
hi def link jediSpace Normal
- hi jediFat term=bold,underline cterm=bold,underline gui=bold,underline ctermbg=0 guibg=Grey
- hi jediFunction term=NONE cterm=NONE ctermfg=6 guifg=Cyan gui=NONE ctermbg=0 guibg=Grey
+ hi jediFat term=bold,underline cterm=bold,underline gui=bold,underline ctermbg=0 guibg=#555555
+ hi jediFunction term=NONE cterm=NONE ctermfg=6 guifg=Black gui=NONE ctermbg=0 guibg=Grey
" override defaults (add jediFunction to contains)
syn match pythonComment "#.*$" contains=pythonTodo,@Spell,jediFunction
When completion is done, the window is automatically split and the pydoc description is shown above the code buffer. This really confuses me while editing code, because the position of the line is changing all the time. Could you please add an option to disable the pydoc buffer or tell me, how to disable it?
Thanks.
Similar to issue #13, but I'm using the latest jedi-vim, and vim 7.3.584, and Vundle rather than Pathogen.
typing:
x = "text"
x.find(
and pressing '' to bring up the omnicompletion results in
x = "text"
(sub, start=None, end=None)
x.find(
which then gets written on save. When I put the cursor on the line, I get:
x = "text"
≡jedi=0, ≡ (*sub*, start=None, end=None) ≡jedi≡
x.find()
http://ompldr.org/vZ3R0dg
\r art
http://ompldr.org/vZ3R0dw
Bug?
P.S. (Sorry for omploader, GitHub say: "Something went really wrong and we can't process that image.")
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.