LanguageClient-neovim icon indicating copy to clipboard operation
LanguageClient-neovim copied to clipboard

Go to definition

Open ANtlord opened this issue 4 years ago • 8 comments

  • Did you upgrade to latest plugin version? Yes

  • Did you upgrade to/compile latest binary? Run shell command bin/languageclient --version to get its version number. languageclient 0.1.161

  • (Neovim users only) Did you check output of :checkhealth LanguageClient?


health#LanguageClient#check
========================================================================
  - OK: binary found: /mnt/home/wantlord/.local/share/nvim/plugged/LanguageClient-neovim/bin/languageclient
  - OK: languageclient 0.1.161
  - OK: Floating window is supported and will be used for hover

health#deoplete#check
========================================================================
## deoplete.nvim
  - OK: exists("v:t_list") was successful
  - OK: has("timers") was successful
  - OK: has("python3") was successful
  - OK: Require Python 3.6.1+ was successful
  - ERROR: Require msgpack 1.0.0+ was not successful
    - ADVICE:
      - Please install/upgrade msgpack 1.0.0+.
  - INFO: If you're still having problems, try the following commands:
    - $ export NVIM_PYTHON_LOG_FILE=/tmp/log
    - $ export NVIM_PYTHON_LOG_LEVEL=DEBUG
    - $ nvim
    - $ cat /tmp/log_{PID}
    - and then create an issue on github

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

## Performance
  - OK: Build type: RelWithDebInfo

## Remote Plugins
  - OK: Up to date

## terminal
  - INFO: key_backspace (kbs) terminfo entry: key_backspace=\177
  - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
  - INFO: $VTE_VERSION='6003'
  - INFO: $COLORTERM='truecolor'

## tmux
  - OK: escape-time: 0ms
  - INFO: $TERM: screen
  - ERROR: $TERM should be "screen-256color" or "tmux-256color" in tmux. Colors might look wrong.
    - ADVICE:
      - Set default-terminal in ~/.tmux.conf:
          set-option -g default-terminal "screen-256color"
      - https://github.com/neovim/neovim/wiki/FAQ

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

## Python 2 provider (optional)
  - INFO: pyenv: Path: /mnt/home/wantlord/.pyenv/libexec/pyenv
  - INFO: pyenv: Root: /mnt/home/wantlord/.pyenv
  - INFO: Using: g:python_host_prog = "/usr/bin/python2"
  - INFO: Executable: /usr/bin/python2
  - ERROR: Command error (job=8, exit code 1): `'/usr/bin/python2' -c 'import sys; sys.path.remove(""); import neovim; print(neovim.__file__)'` (in '/mnt/home/wantlord/develop/study/languageclienttest')
    Output: Traceback (most recent call last):  File "<string>", line 1, in <module>ImportError: No module named neovim
    Stderr: Traceback (most recent call last):  File "<string>", line 1, in <module>ImportError: No module named neovim
  - INFO: Python version: 2.7.18
  - INFO: pynvim version: unable to load neovim Python module
  - ERROR: pynvim is not installed.
    Error: unable to load neovim Python module
    - ADVICE:
      - Run in shell: pip install pynvim

## Python 3 provider (optional)
  - INFO: pyenv: Path: /mnt/home/wantlord/.pyenv/libexec/pyenv
  - INFO: pyenv: Root: /mnt/home/wantlord/.pyenv
  - INFO: Using: g:python3_host_prog = "/usr/bin/python3"
  - INFO: Executable: /usr/bin/python3
  - INFO: Python version: 3.8.6
  - INFO: pynvim version: 0.4.2
  - OK: Latest pynvim is installed.

## Ruby provider (optional)
  - INFO: Ruby: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]
  - WARNING: `neovim-ruby-host` not found.
    - ADVICE:
      - Run `gem install neovim` to ensure the neovim RubyGem is installed.
      - Run `gem environment` to ensure the gem bin directory is in $PATH.
      - If you are using rvm/rbenv/chruby, try "rehashing".
      - See :help |g:ruby_host_prog| for non-standard gem installations.

## Node.js provider (optional)
  - WARNING: `node` and `npm` (or `yarn`) must be in $PATH.
    - ADVICE:
      - Install Node.js and verify that `node` and `npm` (or `yarn`) commands work.

Describe the bug

I work on a Rust project which depends on object. The library parses an object file. The issue happens if I go to definition of a method of the library and then try to get definition of a method inside the method. To be clear as much as possible I prepared the project (See section To Reproduce below). It works with version 0.1.156. It works poorly with 0.1.157. Latest versions have the issue for me.

Environment

  • neovim/vim version (nvim --version or vim --version):
NVIM v0.4.4
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=1 -O2 -g -DMIN_LOG_LEVEL=3 -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/builddir/build/BUILD/neovim-0.4.4/build/config -I/builddir/build/BUILD/neovim-0.4.4/src -I/usr/include -I/usr/include/lua-5.1 -I/builddir/build/BUILD/neovim-0.4.4/build/src/nvim/auto -I/builddir/build/BUILD/neovim-0.4.4/build/include
Compiled by mockbuild

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

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

Run :checkhealth for more info
  • This plugin version (git rev-parse --short HEAD): a42594c
  • This plugin's binary version (bin/languageclient --version): languageclient 0.1.161
  • Minimal vimrc content (A minimal vimrc is the smallest vimrc that could reproduce the issue. Refer to an example here): here in the project
  • Language server link and version: rust-analyzer 14de9e5

To Reproduce

Steps to reproduce the behavior:

  1. Go to the line in main.rs file.
  2. Go to definition of the parse method.
  3. You should end up in source code of the method which is in the dependency.
  4. Try to go to definition of anything from the body of the method. It should fail.

Current behavior

It doesn't go to definition from code of a dependency.

Expected behavior

It goes to definition from code of a dependency like it does with version 0.1.156

Screenshots

None

Additional context

Go to definition works if I walk along the standard library.

UPD: updated checkhealth output

ANtlord avatar Feb 24 '21 19:02 ANtlord

I'm not able to reproduce the issue in your example project. Peek 2021-02-24 19-59

Maybe try adding a minimal vimrc to it so that I can try and reproduce this with your settings.

martskins avatar Feb 24 '21 20:02 martskins

Thank you for the blazing fast reply. The settings I experience the issue with are added to the project. To tell the truth I have no idea what to do except keeping using 0.1.156. Perhaps I can provide some additional technical details?

ANtlord avatar Feb 24 '21 20:02 ANtlord

Ah sorry, missed the init.vim file there. Will try it out with it and let you know how it goes.

martskins avatar Feb 24 '21 20:02 martskins

Still unable to reproduce. Only thing I can think of is try and set the log level to DEBUG and submit the relevant portion of the log here.

martskins avatar Feb 24 '21 20:02 martskins

I caught it. The problem is that my ~/.cargo directory is a symlink. I made it a regular folder then the LanguageClient works. Perhaps LanguageClient stopped dereferencing it after 0.1.156. The problem in not related to Go to definition feature but dereferencing a symlink. Should I close it?

ANtlord avatar Feb 25 '21 09:02 ANtlord

Ah great catch! I recall something related to symlinks being tackled some time ago but I can't remember what it was. I'll try and see if I can find it, maybe we can find the solution there.

martskins avatar Feb 25 '21 21:02 martskins

@ANtlord Is it a symlink purely because you want it to be elsewhere? I have $CARGO_HOME="$XDG_CONFIG_HOME/cargo" for that reason, and don't have this problem.

(I'm not saying LanguageClient shouldn't behave correctly if it is a symlink, just that that might be a quick fix for you.)

OJFord avatar Jul 27 '21 10:07 OJFord

@OJFord that's a very good hint. I completely forgot about it. I've managed the problem with binding mount which works fine unless I need to find something recursilvely. Anyway thanks a lot!

ANtlord avatar Jul 27 '21 11:07 ANtlord