Giter VIP home page Giter VIP logo

jedi-vim's People

Contributors

andviro avatar arturdryomov avatar blueyed avatar d7415 avatar davidhalter avatar dbrgn avatar freeo avatar gotgenes avatar heavenshell avatar inside avatar itchyny avatar jamescherti avatar jgb avatar justincheevers avatar justinmk avatar konfekt avatar littleq0903 avatar lodagro avatar magicreddeer avatar mattn avatar mozbugbox avatar np1 avatar petobens avatar ricobl avatar strycore avatar tndoan avatar toupeira avatar tweekmonster avatar wilywampa avatar zekzekus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jedi-vim's Issues

vim crashes with segfault when completing sys

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.

jedi-vim slow in large files.

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)

Add virtualenv support

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 (

Completion doesn't work when buffer name is not set, even though filetype is

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.

Automatic completion cursor positioning is counter-intuitive.

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.

Rebind autocompletion?

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 :)

Add an option to disable the pydoc split

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.

show_func_def() can be slow

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).

Restore buffer states when closing pydoc buffer

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

Error on load when token.py exists in current directory (Linux)

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?

goto definition: "Couldn't find any definitions for this"

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.

Windows: Vim crashes while auto-completing python sys module

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:

  • import urllib:
    • autocomplete: worked fine
    • goto & get_definition: opened urllib.py in a new tab
    • K: showed doc string in a new split window
  • import sys
    • autocomplete/goto/get_definition/K: gvim exited with the famous windows error 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.
  • import os
    • autocomplete: worked fine
    • goto: opened os.py in a new tab
    • get_definition: opened a quickfix window showing Builtin module nt
    • K: showed doc string in a new split window
  • import json:
    • autocomplete: worked fine
    • goto & get_definition: opened init.py in a new tab
    • K: showed doc string in a new split window
  • import time/datetime
    • autocomplete: worked fine
    • goto & get_definition: showed builtin modules can't be displayed
    • K: showed doc string in a new split window

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:

Error when trying to go to definition of method(s) in import statement

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:

  • Create new python file testa.py with following content:
def methoda():
        pass
def methodb():
        pass
  • Create another python file with following content:
from testa import methoda, methodb
  • Place the cursor on either methoda or methodb and try to go to its definition.

Errors when dealing with named imports

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

python3/dyn support

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!

Error when trying to pydoc function of deduced type

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

Wrong method signatures (sometimes)

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.)

<C-Space> doesn't iterate through the completion options

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>?

key binding and load time issue

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

function definitions popups are hard to read in gvim

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

function argument popup not handled correctly on ctrl+c

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.
 Screenshot - 23 12 2012 - 23:04:44

Completing gobject

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?

vim 7.3 junk text inserted to buffer when using completion (and Vundle)

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) ≡jedix.find()

NameError: name 'jedi_vim' is not defined

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?

Installation through pip - syntax error

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...

Sometimes show_function_definition doesn't work

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

popup_on_dot, forced to navigate list?

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?

How to let jedi complete disable auto select first candidate in popup menu ?

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).

Triggers the popup when I'm typing `...`

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.

ctrl+space doesn't work?

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?

pydoc not working

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.

Crashes when sorted()

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

No completion options for tarfile

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.

(vim <7.3) function-argument completion may insert text into buffer

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:

  • Start vim 7.2 to edit a new python file.
  • Type the following
import numpy as np
np.linspace( 1, 2, 3 )

Also notice that there is no function-argument completion.

  • Place your cursor behind the 3 and press "." in insert mode. The buffer will then look like the following:
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.

Argument pop-up causes erroneous reflow

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.
before
after

auto completion on dot

  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.

Keywordprg not getting set

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

junk text inserted after typing "self."

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

Error detected while processing function jedi#get_definition

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.