autozimu / LanguageClient-neovim

Language Server Protocol (LSP) support for vim and neovim.
MIT License
3.55k stars 273 forks source link

Completion does not work for defined functions #608

Closed SephVelut closed 6 years ago

SephVelut commented 6 years ago

health#LanguageClient#check
========================================================================
  - OK: binary found: /myhome/.vim/plugged/LanguageClient-neovim/bin/languageclient
  - OK: languageclient 0.1.120 183fbf5e1904aae92baabd809ec8589f251481f7

health#nvim#check
========================================================================
## Configuration
  - OK: no issues found

## Performance
  - OK: Build type: Release
    LuaJIT

## Remote Plugins
  - OK: Up to date

## terminal
  - INFO: key_backspace (kbs) terminfo entry: key_backspace=^H
  - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
  - INFO: $TERM_PROGRAM='iTerm.app'
  - INFO: $COLORTERM='truecolor'

health#provider#check
========================================================================
## Clipboard (optional)
  - OK: Clipboard tool found: pbcopy

## Python 2 provider (optional)
  - INFO: pyenv was found, but $PYENV_ROOT is not set. `pyenv root` will be used. If you run into problems, try setting $PYENV_ROOT explicitly.
  - INFO: pyenv: /usr/local/Cellar/pyenv/1.2.7/libexec/pyenv
  - INFO: pyenv root: /myhome/.pyenv
  - INFO: Using: g:python_host_prog = "/myhome/.virtualenvs/neovim2/bin/python"
  - INFO: Executable: /myhome/.virtualenvs/neovim2/bin/python
  - INFO: Python2 version: 2.7.15
  - INFO: python-neovim version: 0.2.6
  - OK: Latest python-neovim is installed: 0.2.6

## Python 3 provider (optional)
  - INFO: pyenv was found, but $PYENV_ROOT is not set. `pyenv root` will be used. If you run into problems, try setting $PYENV_ROOT explicitly.
  - INFO: pyenv: /usr/local/Cellar/pyenv/1.2.7/libexec/pyenv
  - INFO: pyenv root: /myhome/.pyenv
  - INFO: Using: g:python3_host_prog = "/myhome/.virtualenvs/neovim/bin/python3"
  - INFO: Executable: /myhome/.virtualenvs/neovim/bin/python3
  - INFO: Python3 version: 3.7.0
  - INFO: python3-neovim version: 0.2.6
  - OK: Latest python3-neovim is installed: 0.2.6

## Ruby provider (optional)
  - INFO: Ruby: ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]
  - INFO: Host: /myhome/.rvm/gems/ruby-2.2.2/bin/neovim-ruby-host
  - OK: Latest "neovim" gem is installed: 0.7.1

## Node.js provider (optional)
  - INFO: Node.js: v10.9.0
  - INFO: Neovim node.js host: /usr/local/lib/node_modules/neovim/bin/cli.js
  - OK: Latest "neovim" npm/yarn package is installed: 4.2.1
Plug 'racer-rust/vim-racer', { 'do': 'rustup toolchain add beta && rustup toolchain add stable rustup toolchain add stable && rustup component add rust-src && rustup update && cargo install racer', 'for': 'rust' }

Plug 'rust-lang/rust.vim'

Plug 'autozimu/LanguageClient-neovim', {
    \ 'branch': 'next',
    \ 'do': 'bash install.sh',
    \ }

Plug 'ncm2/ncm2'
Plug 'ncm2/ncm2-bufword'
Plug 'ncm2/ncm2-tmux'
Plug 'ncm2/ncm2-path'
Plug 'ncm2/ncm2-racer'
Plug 'roxma/nvim-yarp'

Plug 'ludovicchabant/vim-gutentags'

autocmd BufEnter * call ncm2#enable_for_buffer()
set completeopt=noinsert,menuone,noselect

let g:LanguageClient_serverCommands = {
    \ 'rust': ['~/.cargo/bin/rustup', 'run', 'stable', 'rls'],
    \}

nnoremap <F5> :call LanguageClient_contextMenu()<CR>

Completion for the std library for Rust works fine. Problem is, non of my own defined functions show up. I do have universal ctags installed and have generated a project tags file.

struct A;
impl A { fn foo(){} }

fn main() {
     let a: A = A{};
     a. <---- no completion
     std:: <---------- completion works fine
}

Completion for Rust works 100% with Clion's Rust plugin. Not sure if they're using some special language server but everything works. Maybe I'm doing something wrong?

dre-hh commented 6 years ago

I upvoted first, but last update of rustup toolchain solved it for now. @SephVelut could you run

rustup update
rustup component add rls-preview rust-analysis rust-src
SephVelut commented 6 years ago

Classic. Good to go