autozimu / LanguageClient-neovim

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

Go to definition #1200

Open ANtlord opened 3 years ago

ANtlord commented 3 years ago

health#LanguageClient#check

health#deoplete#check

deoplete.nvim

health#nvim#check

Configuration

Performance

Remote Plugins

terminal

tmux

health#provider#check

Clipboard (optional)

Python 2 provider (optional)

Python 3 provider (optional)

Ruby provider (optional)

Node.js provider (optional)

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

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][min-vimrc.vim]): [here](https://github.com/ANtlord/languageclienttest/blob/master/init.vim) in the project
- Language server link and version: rust-analyzer 14de9e5

[min-vimrc.vim]: https://github.com/autozimu/LanguageClient-neovim/blob/next/min-vimrc.vim

## To Reproduce

Steps to reproduce the behavior:
1. Go to the [line](https://github.com/ANtlord/languageclienttest/blob/master/src/main.rs#L18) 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
martskins commented 3 years ago

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.

ANtlord commented 3 years ago

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?

martskins commented 3 years ago

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

martskins commented 3 years ago

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.

ANtlord commented 3 years ago

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?

martskins commented 3 years ago

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.

OJFord commented 3 years ago

@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.)

ANtlord commented 3 years ago

@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!