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

Error when using deoplete #94

Closed
AdnoC opened this issue Jun 16, 2017 · 7 comments
Closed

Error when using deoplete #94

AdnoC opened this issue Jun 16, 2017 · 7 comments

Comments

@AdnoC
Copy link

AdnoC commented Jun 16, 2017

  • NVIM v0.2.1-279-g0183830
  • deoplete.nvim at commit c8fd11834a76c58ec976be613b3e1c99a97091f8
  • vim-racer at commit 92c3e2b
  • racer 2.0.8
  • Python 3.5.2
  • neovim python module 0.1.13
  • rustc 1.17.0 (56124baa9 2017-04-24)
  • cargo 0.18.0 (fe7b0cdcf 2017-04-24)

In certain situations I get an error when adding a new global constant.

The error is

[deoplete] Traceback (most recent call last):
[deoplete] File "/home/adno/.config/nvim/bundle/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", line 119, in gather_results
[deoplete] ctx['candidates'] = source.gather_candidates(ctx)
[deoplete] File "/home/adno/.config/nvim/bundle/vim-racer/rplugin/python3/deoplete/sources/racer.py", line 71, in gather_candidates
[deoplete] kind = typeMap.get(completions[4], '')
[deoplete] IndexError: list index out of range
[deoplete] Could not get completions from: racer. Use :messages for error details.

Steps to reproduce using nvim -u minimal.vim

minimal.vim

call plug#begin()
    Plug 'Shougo/deoplete.nvim'
    Plug 'racer-rust/vim-racer'
call plug#end()

let g:deoplete#enable_at_startup = 1

Steps

Create a new project

cargo new tmp
cd tmp

Edit the generated lib.rs

nvim -u PATH/TO/minimal.vim src/lib.rs

Add a constant to the file. For example, the file might then look like this:

#[cfg(test)]
mod tests {
    #[test]
    fn it_works() {
    }
}

pub const A_CONST: u8 = 2;

In the line above the const, try to add another constant. For example:

#[cfg(test)]
mod tests {
    #[test]
    fn it_works() {
    }
}

pub const SECOND_CONST: u8 = 1;
pub const A_CONST: u8 = 2;

You will get an error after writing just pub const SE (since that is the default minimum length for completion).


I added a debug print line to the gather_candidates function of racer.py. Apparently when the error occurs it is because completions is a single item array containing just the identifier of the partially typed second constant.

@AdnoC
Copy link
Author

AdnoC commented Jun 16, 2017

Actually, this looks like its a racer problem. Calling racer manually to complete the position (racer complete 8 11 src/lib.rs) results in

PREFIX 76,77,S
MATCH SE
pub const A_CONST,8,10,src/lib.rs,Const,pub const SE
MATCH Send,43,17,/home/adno/.multirust/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/../libcore/marker.rs,Trait,pub unsafe trait Send
MATCH Sized,92,10,/home/adno/.multirust/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/../libcore/marker.rs,Trait,pub trait Sized
MATCH Sync,346,17,/home/adno/.multirust/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/../libcore/marker.rs,Trait,pub unsafe trait Sync
MATCH Some,165,4,/home/adno/.multirust/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/../libcore/option.rs,EnumVariant,Some(#[stable(feature = "rust1", since = "1.0.0")] T),
MATCH SliceConcatExt,1247,10,/home/adno/.multirust/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/../libcollections/slice.rs,Trait,pub trait SliceConcatExt<T: ?Sized>
MATCH String,263,11,/home/adno/.multirust/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/../libcollections/string.rs,Struct,pub struct String
END

Note the line break between the "MATCH SE" and the "pub const A_CONST,8,10,src/lib.rs,Const,pub const SE". vim-racer probably isn't capturing it all as a single entry because the parts are on separate lines.

@AdnoC
Copy link
Author

AdnoC commented Jun 16, 2017

Adding println!s to racer confirmed that the issue is indeed caused by racer.

I opened an issue there (racer-rust/racer#746).

@Shougo
Copy link
Contributor

Shougo commented Jun 17, 2017

OK. I wait until the problem is fixed.

@andreyorst
Copy link

Any update on this? Expiriencing the same issue

@Shougo
Copy link
Contributor

Shougo commented Mar 12, 2018

No response from upstream yet.
So same problem exists in racer.

@Parasrah
Copy link

From taking a look at the issue opened on racer it looks like this issue has been resolved upstream 14 days ago

@Shougo
Copy link
Contributor

Shougo commented Aug 26, 2018

OK.

@Shougo Shougo closed this as completed Aug 26, 2018
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