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

Replace command not working with some Variables, and the "Find Uses" command <leader>n gives an Error on said Vars.. #900

Closed
Ratione opened this issue Jan 23, 2019 · 4 comments

Comments

@Ratione
Copy link

Ratione commented Jan 23, 2019

Issue

I was working on This file, its a basic, less than 200 line PSO implementation, and I was trying to rename num_dimensions. When I typed ,r it would throw me into insert mode with the name deleted, and when typed dimNum to replace it, then hit it returned it to num_dimensions, like I had entered nothing. Replace works fine on the Particles class.

I then tried to run the 'Find Uses of' command ,n and it spat out a long error, which I posted at the bottom. Again, it worked fine on Particle and a couple other vars.

Steps to reproduce

  1. Download the PSO file
  2. Run the <leader>n command on num_dimensions - First appears in the Particle Class, line 53
  3. ???
  4. Profit. I mean Error. Yeah, that one.

Output of “:version”

NVIM v0.4.0-dev
Build type: RelWithDebInfo
Lua 5.1
Compilation: /usr/bin/x86_64-linux-gnu-gcc -g -O2 -fstack-protector-strong -Wformat -Werror=
format-security -Wshadow -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -g -DMIN_LOG
_LEVEL=3 -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99
 -Wvla -fstack-protector-strong -fdiagnostics-color=auto -Wno-array-bounds -DINCLUDE_GENERAT
ED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/build/
neovim-KQpGed/neovim-0.4.0+ubuntu1+git201901212036-969618e-eada8be/build/config -I/build/neo
vim-KQpGed/neovim-0.4.0+ubuntu1+git201901212036-969618e-eada8be/src -I/build/neovim-KQpGed/n
eovim-0.4.0+ubuntu1+git201901212036-969618e-eada8be/.deps/usr/include -I/usr/include -I/buil
d/neovim-KQpGed/neovim-0.4.0+ubuntu1+git201901212036-969618e-eada8be/build/src/nvim/auto -I/
build/neovim-KQpGed/neovim-0.4.0+ubuntu1+git201901212036-969618e-eada8be/build/include
Compiled by buildd@lgw01-amd64-030

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Jedi-vim debug information

jedi-vim version
  • jedi-vim git version: 0.9.0-62-g7f4f2db
  • jedi git submodule status: -bd1010bbd2693f189ff780eb21fc4294071cb280 pythonx/jedi
  • parso git submodule status: -930ec08ab0cd77aae07e24aa78f9c5119be216bb pythonx/parso
Global Python

Using Python version 3 to access Jedi.

  • global sys.version: 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 01:22:34), [GCC 7.3.0]
  • global site module: /home/Logos/anaconda3/envs/spinningup/lib/python3.6/site.py
Jedi
  • path: /home/Logos/anaconda3/envs/spinningup/lib/python3.6/site-packages/jedi/__init__.py
  • version: 0.13.2
Jedi environment: <SameEnvironment: 3.6.8 in /home/Logos/anaconda3/envs/spinningup>
  • executable: /home/Logos/anaconda3/envs/spinningup/bin/python3
  • sys_path:
    • /home/Logos/anaconda3/envs/spinningup/lib/python36.zip
    • /home/Logos/anaconda3/envs/spinningup/lib/python3.6
    • /home/Logos/anaconda3/envs/spinningup/lib/python3.6/lib-dynload
    • /home/Logos/anaconda3/envs/spinningup/lib/python3.6/site-packages
    • /home/Logos/spinningup
Known environments
  • <Environment: 3.7.1 in /home/Logos/anaconda3> (/home/Logos/anaconda3/bin/python3.7)
  • <Environment: 3.6.8 in /home/Logos/anaconda3/envs/spinningup> (/home/Logos/anaconda3/envs
    /spinningup/bin/python3.6)
  • <Environment: 3.5.2 in /usr> (/usr/bin/python3.5)
  • <Environment: 2.7.12 in /usr> (/usr/bin/python2.7)
Settings
g:jedi#popup_select_first = 0 (default: 1)
g:jedi#use_splits_not_buffers = 'bottom' (default: 1)
g:jedi#popup_on_dot = 0 (default: 1)
g:jedi#auto_vim_configuration = 0 (default: 1)

  omnifunc=jedi#completions
        Last set from ~/.vim/bundle/jedi-vim/autoload/jedi.vim
  completeopt=menu,preview
Find Error
Traceback (most recent call last):
  File "/home/Logos/.config/nvim/bundle/jedi-vim/pythonx/jedi_vim.py", line 140, in wrapper
    return func(*args, **kwargs)
  File "/home/Logos/.config/nvim/bundle/jedi-vim/pythonx/jedi_vim.py", line 393, in usages
    definitions = script.usages()
  File "/home/Logos/anaconda3/envs/spinningup/lib/python3.6/site-packages/jedi/api/__init__.
py", line 310, in usages
    return _usages(**kwargs)
  File "/home/Logos/anaconda3/envs/spinningup/lib/python3.6/site-packages/jedi/api/__init__.
py", line 304, in _usages
    names = usages.usages(self._get_module(), tree_name)
  File "/home/Logos/anaconda3/envs/spinningup/lib/python3.6/site-packages/jedi/evaluate/usag
es.py", line 47, in usages
    new = _find_names(m, name_leaf)
  File "/home/Logos/anaconda3/envs/spinningup/lib/python3.6/site-packages/jedi/evaluate/usag
es.py", line 33, in _find_names
    found_names = set(name.goto())
  File "/home/Logos/anaconda3/envs/spinningup/lib/python3.6/site-packages/jedi/evaluate/filt
ers.py", line 55, in goto
    return self.parent_context.evaluator.goto(self.parent_context, self.tree_name)
  File "/home/Logos/anaconda3/envs/spinningup/lib/python3.6/site-packages/jedi/evaluate/__in
it__.py", line 315, in goto
    search_global=True, is_goto=True
  File "/home/Logos/anaconda3/envs/spinningup/lib/python3.6/site-packages/jedi/_compatibilit
y.py", line 274, in <lambda>
    return lambda *args, **kwargs: self.func(obj, *args, **kwargs)
  File "/home/Logos/anaconda3/envs/spinningup/lib/python3.6/site-packages/jedi/evaluate/base
_context.py", line 161, in py__getattribute__
    return f.filter_name(filters)
  File "/home/Logos/anaconda3/envs/spinningup/lib/python3.6/site-packages/jedi/evaluate/find
er.py", line 153, in filter_name
    if self._name.get_definition().type == 'import_from':
AttributeError: 'NoneType' object has no attribute 'type'
@blueyed
Copy link
Collaborator

blueyed commented Jan 23, 2019

This appears to be an error in jedi itself.
Is this reproducible for you given the linked file in a fresh virtualenv, i.e. can this be reproduced easily?

@Ratione
Copy link
Author

Ratione commented Jan 23, 2019

Yes. EDIT: Updated post with relevant info

Its a really simple program, not using meta classes or 10 layers of nested classes. It is only using the Math and Random libraries so far. It could easily be reduced to less than 60 lines of actual code, but I just hadn't got that far.

There are commented out imports, but I hadn't implemented those features yet. So far all that's in there is the header, the 2 imports, a super basic cost function, a Particle class, that keeps track of the individual particle objects, and the PSO class, which is the parent class, that keeps track of the aggregate swarm.

Again, I don't know how helpful that information is, but let me know if you guys need anything else. The entire install is about a week old, I haven't had time to fuck it up too badly. The whole point was keeping the environment light so I could keep the dependencies down, so there isn't much on the Ubuntu install other than Anaconda, and a few machine learning libraries.

@davidhalter
Copy link
Owner

If you want to help me fix this, I'd be very happy if you tried to reproduce it just with Jedi. This is a Jedi bug and has basically nothing to do with jedi-vim. If you can use jedi.Script().usages() for this and reproduce it, you can just report it in the jedi issue tracker.

@isczg
Copy link

isczg commented Feb 20, 2019

I've met the same issue. I found reverting jedi (not jedi-vim) to 0.12.1 or earlier version could solve the problem.

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

4 participants