rls icon indicating copy to clipboard operation
rls copied to clipboard

Unable to goto/peek definition in VSCode using rls

Open Neo-Mind opened this issue 5 years ago • 17 comments

Hi, I am not able to use either the "Goto Definition" or "Peek Definition" options in VSCode using RLS for any functions/structs/enums etc coming from crates (std library ones are working fine).

Code completion is working however and when i hover over the items i get the description window properly. So not sure why only the definition part is not working.

I checked with multiple crates but same issue is seen in all cases. I did not see any issue opened related to this but if there is already one please point me to that. I am on Lubuntu 18.04

Neo-Mind avatar Nov 06 '18 10:11 Neo-Mind

Hi! This was a regression that took a bit of time to get fixed upstream in Rust (https://github.com/rust-lang/rust/commit/56ac2c4fc3a287c189abb2db5fd26a53f30ef9e7, only 2 days ago). Can you try running rustup update nightly (stable and beta should not have been affected) and see if the problem still persists?

Xanewok avatar Nov 07 '18 11:11 Xanewok

tried it, the problem is still there. Also checked stable version but same issue is there. Interesting part is some of the definitions is being detected properly while all the others come up as "No definition found"

Neo-Mind avatar Nov 07 '18 18:11 Neo-Mind

Same here. Updated nightly and stable, still doesn't work.

yanlipnican avatar Nov 13 '18 13:11 yanlipnican

Working with stable and beta rust, not working on nightly. Same effect for "hover/highlight". "method": "textDocument/definition" - server return nothing

Edit: hover is Ok, highlight - return nothing. Edit: try to compile from source (cause toolchains not updated from 1c755ef 2018-10-20).

../../rls/target/debug/rls -V
rls-preview 0.130.5 (750be58 2018-11-15)

fall to error:

thread 'request-worker-7' panicked at 'error in for_each_crate, found 2 results, expected 0 or 1', /home/diabolo/.cargo/registry/src/github.com-1ecc6299db9ec823/rls-analysis-0.16.6/src/analysis.rs:211:```

diaevd avatar Nov 15 '18 07:11 diaevd

Windows 10, VS Code no auto complete at all and peek on crate stuff doesn't work, sometimes peek gets it wrong on local stuff aswell

rls --version >>> rls-preview 1.31.6 (daa138c 2018-11-20)

henrikvik avatar Nov 22 '18 14:11 henrikvik

Just chiming in - I often have this problem after upgrading, doing a cargo clean with the IDE not running, and then starting the IDE often fixes it.

EDIT: I am on Ubuntu 18.04 and Eclipse Corrosion. I seem to get this bug more often after:

  • code format
  • compilation failure in the IDE (syntax errors)

norru avatar Nov 27 '18 00:11 norru

This does not fix it for me, I also tried a fresh install of Linux (Manjaro) and I have the same problems, no autocomplete or peek on crate stuff.

henrikvik avatar Nov 30 '18 16:11 henrikvik

This should work on a newest stable. Do you still have this problem?

Xanewok avatar Mar 03 '19 14:03 Xanewok

Still not working for me:

  • Elementary Juno: Linux version 5.0.0-050000-generic (kernel@gloin) (gcc version 8.2.0 (Ubuntu 8.2.0-21ubuntu1))
  • VSCode: v1.32.3 + RLS 0.5.4
  • rustc 1.35.0-nightly (e782d790f 2019-03-29)

Tried cargo clean + rebuild also

sendittokeith avatar Mar 30 '19 19:03 sendittokeith

RLS 0.5.4 sounds very old. Is it the plugin's or the actual language server's version?

norru avatar Mar 30 '19 23:03 norru

That is the version (current) in VSCode extension repo released 3/9/2019. This is not a new issue with regards to that release date, this has been happening to me now for months. Thanks for checking on that, you had me wondering :-)

On Mar 30 2019, at 4:38 pm, Nico Orrù [email protected] wrote:

RLS 0.5.4 sounds very old. Is it the plugin's or the actual language server's version?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub (https://github.com/rust-lang/rls/issues/1115#issuecomment-478298686), or mute the thread (https://github.com/notifications/unsubscribe-auth/ABq3Pn1ugosISXgJATEetgz83llKb6aRks5vb_V7gaJpZM4YQHUR).

sendittokeith avatar Mar 31 '19 20:03 sendittokeith

Still not working for me:

  • Elementary Juno: Linux version 5.0.0-050000-generic (kernel@gloin) (gcc version 8.2.0 (Ubuntu 8.2.0-21ubuntu1))
  • VSCode: v1.32.3 + RLS 0.5.4
  • rustc 1.35.0-nightly (e782d790f 2019-03-29)

Tried cargo clean + rebuild also

Helped me on macOS 0.14.5 / VSCode 1.41.1 / rls 1.40.0 (5db91c7 2019-10-30)

alun avatar Jan 03 '20 09:01 alun

I have this issue too I can use goto/peek to go from my code to a crate, but no further. Can't use goto/peek on anything in a crate (even if defined in the same file). In other words only 1 level deep.

macOS 10.15.5 / VSCode 1.47.1 / rustc 1.44.1

ashneverdawn avatar Jul 15 '20 23:07 ashneverdawn

I have this issue too I can use goto/peek to go from my code to a crate, but no further. Can't use goto/peek on anything in a crate (even if defined in the same file). In other words only 1 level deep.

macOS 10.15.5 / VSCode 1.47.1 / rustc 1.44.1

Yea, same problem here! It seems to work with Jetbrains though, so maybe this is a VSCode issue?

UPDATE: use the rust-analyzer extension instead of rls and it should work 🙌

timonbimon avatar Jul 21 '20 12:07 timonbimon

That helped. Thanks!

ashneverdawn avatar Jul 21 '20 21:07 ashneverdawn

I have this issue too I can use goto/peek to go from my code to a crate, but no further. Can't use goto/peek on anything in a crate (even if defined in the same file). In other words only 1 level deep. macOS 10.15.5 / VSCode 1.47.1 / rustc 1.44.1

Yea, same problem here! It seems to work with Jetbrains though, so maybe this is a VSCode issue?

UPDATE: use the rust-analyzer extension instead of rls and it should work 🙌

Still doesn't work for me.

Windows 10 version 1909 / VSCode 1.47.3 / rustc 1.45.0

deprilula28 avatar Aug 04 '20 15:08 deprilula28

Installing matklad.rust-analyzer and then clicking the VSCode prompt to install the LS for it fixed it for me. :+1:

I was expecting the more popular extension to work out of the box, is there another piece that I'm missing? Initially I installed rust-lang.rust, which didn't give me any go-to or peek definitions. After removing it and installed the matklad.rust-analyzer it worked.

onx2 avatar Oct 06 '20 15:10 onx2