Giter VIP home page Giter VIP logo

deoplete-rust's Introduction

Salut, my name is Sebastian.

I'm the lead engineer (ML/MLOps) @metro.digital, working on recommender systems across Metro's e-commerce platform.

Topics

  • model serving / service mesh
  • online Bayesian A/B experimentation
  • representation-based learning for recommendation systems
  • low latency approximate nearest neighbor search (vector similarity)
  • model & data governance, data quality and observability

You can reach me at [email protected]

deoplete-rust's People

Contributors

sapphire-arches avatar sebastianmarkow avatar tenfyzhong 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

deoplete-rust's Issues

Filter out duplicate racer results?

From what I can understand from Shougo, deoplete has an option to hide duplicate results.

racer is still very much buggy and returns duplicate results a lot. Here's a screenshot plus actual racer output confirming the issue:

suggestions

mqudsi@ZBook /m/c/U/M/g/static-compress> racer complete 16 48 src/structs.rs  | grep Enum
MATCH CompressionAlgorithm,10,9,src/structs.rs,Enum,pub enum CompressionAlgorithm {
MATCH CompressionAlgorithm,10,9,src/structs.rs,Enum,pub enum CompressionAlgorithm {
MATCH CompressionAlgorithm,10,9,src/structs.rs,Enum,pub enum CompressionAlgorithm {
MATCH Some,165,4,/mnt/c/Users/Mahmoud/git/rust/src/libstd/../libcore/option.rs,EnumVariant,Some(#[stable(feature = "rust1", since = "1.0.0")] T),
MATCH None,162,4,/mnt/c/Users/Mahmoud/git/rust/src/libstd/../libcore/option.rs,EnumVariant,None,
MATCH Ok,256,4,/mnt/c/Users/Mahmoud/git/rust/src/libstd/../libcore/result.rs,EnumVariant,Ok(#[stable(feature = "rust1", since = "1.0.0")] T),
MATCH Err,260,4,/mnt/c/Users/Mahmoud/git/rust/src/libstd/../libcore/result.rs,EnumVariant,Err(#[stable(feature = "rust1", since = "1.0.0")] E),
MATCH Some,165,4,/mnt/c/Users/Mahmoud/git/rust/src/libstd/../libcore/option.rs,EnumVariant,Some(#[stable(feature = "rust1", since = "1.0.0")] T),
MATCH None,162,4,/mnt/c/Users/Mahmoud/git/rust/src/libstd/../libcore/option.rs,EnumVariant,None,
MATCH Ok,256,4,/mnt/c/Users/Mahmoud/git/rust/src/libstd/../libcore/result.rs,EnumVariant,Ok(#[stable(feature = "rust1", since = "1.0.0")] T),
MATCH Err,260,4,/mnt/c/Users/Mahmoud/git/rust/src/libstd/../libcore/result.rs,EnumVariant,Err(#[stable(feature = "rust1", since = "1.0.0")] E),
MATCH CompressionAlgorithm,10,9,src/structs.rs,Enum,pub enum CompressionAlgorithm {
MATCH Some,165,4,/mnt/c/Users/Mahmoud/git/rust/src/libstd/../libcore/option.rs,EnumVariant,Some(#[stable(feature = "rust1", since = "1.0.0")] T),
MATCH None,162,4,/mnt/c/Users/Mahmoud/git/rust/src/libstd/../libcore/option.rs,EnumVariant,None,
MATCH Ok,256,4,/mnt/c/Users/Mahmoud/git/rust/src/libstd/../libcore/result.rs,EnumVariant,Ok(#[stable(feature = "rust1", since = "1.0.0")] T),
MATCH Err,260,4,/mnt/c/Users/Mahmoud/git/rust/src/libstd/../libcore/result.rs,EnumVariant,Err(#[stable(feature = "rust1", since = "1.0.0")] E),
MATCH Some,165,4,/mnt/c/Users/Mahmoud/git/rust/src/libstd/../libcore/option.rs,EnumVariant,Some(#[stable(feature = "rust1", since = "1.0.0")] T),
MATCH None,162,4,/mnt/c/Users/Mahmoud/git/rust/src/libstd/../libcore/option.rs,EnumVariant,None,
MATCH Ok,256,4,/mnt/c/Users/Mahmoud/git/rust/src/libstd/../libcore/result.rs,EnumVariant,Ok(#[stable(feature = "rust1", since = "1.0.0")] T),
MATCH Err,260,4,/mnt/c/Users/Mahmoud/git/rust/src/libstd/../libcore/result.rs,EnumVariant,Err(#[stable(feature = "rust1", since = "1.0.0")] E),

Can you either filter out the duplicates by running the racer output through uniq (or similar) or by using deoplete's native deduplication feature?

Another "racer binary not set" issue

Like #4, I'm having an issue with an incorrect "racer binary not set" error when trying to use deoplete-rust. Unlike #4, I'm already using the full path to racer:

:let g:deoplete#sources#rust#racer_binary
g:deoplete#sources#rust#racer_binary  /home/mqudsi/.cargo/bin/racer

I'm not sure what other info to provide. Using the latest (master) versions of deoplete and deoplete-rust, deoplete works well otherwise. This is on WSL.

Multi match complete menù

screenshot_20180313_002719
I have a problem with deoplete rust, how you can see, completitinion menù displays the same line as the previous ones

No syntax nor completion

I've installed deoplete-rust like the README said I should, and deoplete works, I used full paths for the racer binary and the rust source, but now I'm getting no synatx highlighting nor completion in rust source files.

CheckHealth.txt

:CheckHealth reports nothing wrong, and here's my ~/.config/nvim/init.vim:

init.vim

Deoplete and rust work independently.

Error on every file edit

Every insert, delete, paste, ... suddenly produces a big fat popup error that is confusing to read:

Only happens in Rust files. In this repo.

Error detected while processing function <SNR>23_neomake_automake[12]..<SNR>23_configure_buffer[51]..neomake#core#create_jobs[2]..<SNR>27_bind_makers_for_job[
5]..neomake#core#instantiate_maker[18]..26[2]..<SNR>152_get_cargo_maker_cwd[1]..<SNR>152_get_cargo_workspace_root[19]..neomake#compat#json_decode:
line    5:
E474: Unidentified byte: warning: patch for the non root package will be ignored, specify patch at the workspace root:^@package:   /home/steven/code/rust/bitc
oincore-rpc/client/Cargo.toml^@workspace: /home/steven/code/rust/bitcoincore-rpc/Cargo.toml^@{"packages":[{"name":"bitcoincore-rpc-json","version":"0.2.0","id
":"bitcoincore-rpc-json 0.2.0 (path+file:///home/steven/code/rust/bitcoincore-rpc/json)","license":"CC0-1.0","license_file":null,"description":"JSON-enabled t
ype structs for bitcoincore-rpc crate.","source":null,"dependencies":[{"name":"bitcoin","source":"registry+https://github.com/rust-lang/crates.io-index","req"
:"^0.17","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":["serde-decimal"],"target":null},{"name":"bitcoin-amount","source"
:"registry+https://github.com/rust-lang/crates.io-index","req":"^0.1.4","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":["s
erde"],"target":null},{"name":"bitcoin_hashes","source":"registry+https://githu



Error detected while processing function <SNR>23_neomake_automake[12]..<SNR>23_configure_buffer[51]..neomake#core#create_jobs[2]..<SNR>27_bind_makers_for_job[
5]..neomake#core#instantiate_maker[18]..26[2]..<SNR>152_get_cargo_maker_cwd[1]..<SNR>152_get_cargo_workspace_root[19]..neomake#compat#json_decode:
line    5:
E474: Failed to parse warning: patch for the non root package will be ignored, specify patch at the workspace root:^@package:   /home/steven/code/rust/bitcoin
core-rpc/client/Cargo.toml^@workspace: /home/steven/code/rust/bitcoincore-rpc/Cargo.toml^@{"packages":[{"name":"bitcoincore-rpc-json","version":"0.2.0","id":"
bitcoincore-rpc-json 0.2.0 (path+file:///home/steven/code/rust/bitcoincore-rpc/json)","license":"CC0-1.0","license_file":null,"description":"JSON-enabled type
 structs for bitcoincore-rpc crate.","source":null,"dependencies":[{"name":"bitcoin","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^
0.17","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":["serde-decimal"],"target":null},{"name":"bitcoin-amount","source":"r
egistry+https://github.com/rust-lang/crates.io-index","req":"^0.1.4","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":["serd
e"],"target":null},{"name":"bitcoin_hashes","source":"registry+https://github.c




Error detected while processing function <SNR>23_neomake_automake:
line   12:
E171: Missing :endif

IndexError when the candidate is bad

When using the Struct::function() syntax deoplete-rust throws the following error.

[deoplete] Traceback (most recent call last):                                                                                                                                
  File "/home/aggoetey/.local/share/nvim/plugged/deoplete.nvim/rplugin/python3/deoplete/child.py", line 220, in _gather_results                                              
    ctx['candidates'] = source.gather_candidates(ctx)                                                                                                                        
  File "/home/aggoetey/.local/share/nvim/plugged/deoplete-rust/rplugin/python3/deoplete/sources/rust.py", line 61, in gather_candidates                                      
    'kind': tokens[4],                                                                                                                                                       
IndexError: list index out of range                                                                                                                                          
Error from rust: IndexError('list index out of range').  Use :messages / see above for error details. 

Adding a simple check in the rust.py file to make sure that len(tokens) > 5 stops this crash from happening and makes it function as expected.

Autocompletions and such don't work within test configured modules

This might not be the right place to ask this, as I think the issue exists sort of more generally within the compiler ecosystem (that is to say, the problem is with Racer or cargo not being configured properly to give the right responses), so I apologize for that.

However, does anyone know why I would be experiencing a lack of autocompletion or warnings or anything inside test modules? An example with annotations

struct GonnaTest {
    stuff: u64,
}

impl GonnaTest {
    pub fn new() -> Self {
        5  // I'll get an error showing up here
    }

    pub fn get_it(&self) -> u64 {
        self.stuff // this autocompleted fine
    }
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn whee() {
        assert_eq!(GonnaTest::new(), 5); // no issue here in vim; no autocompletions anywhere
    }
}

I think basically I'd need to just tell cargo/racer that I'm always in a test configuration when querying from deoplete, but I don't know how to do that.

Any advice?

Thanks!

Automatic racer binary and rust source path detection

I think that deoplete-rust should attempt to find the racer binary and rust source path if the user doesn't specify.

I used the something similar to the following in my vimrc to do that:

if executable('racer')
  let g:deoplete#sources#rust#racer_binary = systemlist('which racer')[0]
endif

if executable('rustc')
    " if src installed via rustup, we can get it by running 
    " rustc --print sysroot then appending the rest of the path
    let rustc_root = systemlist('rustc --print sysroot')[0]
    let rustc_src_dir = rustc_root . '/lib/rustlib/src/rust/src'
    if isdirectory(rustc_src_dir)
        let g:deoplete#sources#rust#rust_source_path = rustc_src_dir
    endif
endif

I'm not sure if this project is actively maintained (last commit July 18?)

I could try to make a PR if you wish

RLS or neovim/vim

Hi there,
I would like to know whether you believe missing completion items to be from the RLS side or something in the neovim/vim side.
my main.rs file looks like this

use std::rc::{Rc,Weak};

fn my_func() {}

fn main() {
    let A = Rc::new(50);
    let B = Rc::clone(&A);
    println!("{:?} {:?}",B,A);
}

When finishing the line defining B i don't see clone in the completion options for Rc::
the second thing is a list of completions can be seen when typing A. but not B.

I have an init.vim

filetype plugin indent on 
"" the junegun plugged section
call plug#begin('~/.local/share/nvim/plugged')
Plug 'rust-lang/rust.vim'
Plug 'autozimu/LanguageClient-neovim', {
    \ 'branch': 'next',
    \ 'do': 'bash install.sh',
    \ }
Plug 'sebastianmarkow/deoplete-rust'

if has('nvim')
  Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
else
  Plug 'Shougo/deoplete.nvim'
  Plug 'roxma/nvim-yarp'
  Plug 'roxma/vim-hug-neovim-rpc'
endif
call plug#end()
let g:deoplete#sources#rust#racer_binary='~/.cargo/bin/racer'
let g:deoplete#sources#rust#rust_source_path='~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu'
" Required for operations modifying multiple buffers like rename.
set hidden

let g:deoplete#enable_at_startup = 1

Let me know if you have any ideas about this.

Documentation from objects not shown in completion window

When trying to use deoplete-rust autocompletion on an object I can see the list of attributes and methods in a drop down selection but going through that drop down selection does not show the comments/documentation about that attribute/method only that method's signature, in the way you can in other languages.

Here's an asciinema example of what I get using a default configuration (setting the required variables) with deoplete-rust in the case of a simple Vec.
https://asciinema.org/a/4W973QDH549qN1RyGVsPwY0rw

I'm wondering if it's possible to show something like in the case of Python with deoplete-jedi, where going through the selection shown you can see the complete docstring in addition to the method's signature:
https://asciinema.org/a/hiWC2Yg6DwF32gFWbRmQPVelL

I'm running latest master as of today, commit ID: 0a86e50, with neovim v.0.3.1

Having the documentation associated with a method/function is very helpful and pretty fundamental, since most completion engines normally show this information in IDE environments.

Support for showing uses of a definition?

Hi,

A nice feature would be to show the uses of a definition.

E.g. if the cursor is on a function definition, a keybinding shows all the call sites.

Similarly for variable names etc.

Thanks

Bug: DeopleteRustGoToDefinition panicks for certain definitions

Steps to reproduce:

  1. Navigate to src/libstd/net/addr.rs in core rust source
  2. Find the code associated with SocketAddrV4:
pub struct SocketAddrV4 { inner: c::sockaddr_in }
  1. Hover over sockaddr_in and use gd command to go to definition

An error is produced:

Error detected while processing function <SNR>48_DeopleteRustGoToDefinition:
line   16:
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:373:21^@note: run with `RUST_BACKTRACE=1` e
nvironment variable to display a backtrace.^@
Press ENTER or type command to continue

Still maintained?

I just tried to install this. When I hit K, I get this error:

Error detected while processing function <SNR>28_DeopleteRustShowDocumentation:
line   20:
Unable to find libstd under RUST_SRC_PATH. N.B. RUST_SRC_PATH variable needs to point to the *src* directory inside a rust checkout e.g. "/home/foouser/src/rust/src". Current value ""/Users/phlippieb/.rust/rust/src/libstd""^@

As far as I can tell, my config is correct. I cloned rust into .rust in my home dir and configured deplete-rust like this:

let g:deoplete#sources#rust#racer_binary='/Users/phlippieb/.cargo/bin/racer'
let g:deoplete#sources#rust#rust_source_path='/Users/phlippieb/.rust/rust/src'

I think the issue is simply that the rust repo has changed. I think libstd used to be at https://github.com/rust-lang/rust/tree/master/src/libstd, but following the link will demonstrate that it's not there anymore.

If this repo is still maintained, it would be really cool if this could get fixed!

Racer binary not set, but AFAICS it is

$ which racer
/home/edd/.cargo/bin/racer

In vimrc:

let g:deoplete#sources#rust#racer_binary='~/.cargo/bin/racer'
let g:deoplete#sources#rust#rust_source_path='/home/edd/research/metarust'

Then gd in vim:

racer binary path not set (:help deoplete-rust) 

Let's echo the variable in vim:

:let g:deoplete#sources#rust#racer_binary
g:deoplete#sources#rust#racer_binary  ~/.cargo/bin/racer

Not sure what's going in. I've gotten this working in the past.

Display parameters when calling a function

It would be helpful to have the name and type of the parameters displayed when opening the (.

Example:

fn foo(a: u32, b: &str, c: bool) {}

fn main() { 
    foo(<caret>
       >  foo(*a: u32*, b: &str, c: bool)

    // After a
    foo(31, <caret>
          > foo(a: u32, *b: &str*, c: bool)
}

Note: The lines starting with > are the "completion popup". The parameter surrounded with * should be bold.

Unfortunately, I'm not using deoplete anymore because Rust support for vim/neovim isn't very good.

Handle racer result containing newlines

Sometimes when a file doesn't parse, racer seems to return bogus MATCH results containing newlines, such as:

PREFIX 402,405,WAS
MATCH WAS
pub const NO_CACHED_CODE,19,10,/home/fabian/rust/test.rs,Const,pub const WAS
END

Resulting in errors such as this:

screenshot_2018-07-06_11-55-36

no such subcommand: `complete-with-snippet

When I run a command, be it 'K' or 'gd', it returns this error message:

Error detected while processing function <SNR>70_DeopleteRustShowDocumentation:
line   20:
error: no such subcommand: `complete-with-snippet`^@
Press ENTER or type command to continue

What is the fix to this issue?

Doesn't do anything

I tried to use this deoplete source but I am unable to get this working. I installed race, cloned the rust source code, configure everything as explained. Before correct configuration, there was a startup warning that racer wasn't found. So at least some code seems to be evaluated. However, I do not get any completions. Any idea how to debug this?

Going to definition resets fold levels

Hello,

Quite a simple issue but really annoying:
I have syntax based folding activated (set foldmethod=syntax), but when I press gd to go to the definition of a variable for example, it resets all of the folds on the current buffer.

What could be the issue here ?

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.