Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Unable to find any definitions in VSCode #674

Closed
theotherphil opened this issue Jan 21, 2018 · 18 comments
Closed

Unable to find any definitions in VSCode #674

theotherphil opened this issue Jan 21, 2018 · 18 comments
Labels

Comments

@theotherphil
Copy link

I've installed the RLS extension for VSCode, but searching for definitions, even within the same file, never finds anything. What steps should I take to either debug what's going on or generate a more useful bug report?

@Geobert
Copy link

Geobert commented Jan 27, 2018

same issue, using "rust-client.channel": "stable"
weird thing is that it worked yesterday, today it broke without any reason, and no output either.

@Geobert
Copy link

Geobert commented Jan 27, 2018

after many manipulation, I got an output: https://gist.github.com/Geobert/207b2fdae3b5ceca01bb025e90373dd0

@Jack-Works
Copy link

image
Yes, got the same problem

@Geobert
Copy link

Geobert commented Jan 28, 2018

I tried Atom, broken as well, so it seems it's an RLS issue

@nrc nrc added the bug label Feb 1, 2018
@nrc
Copy link
Member

nrc commented Feb 1, 2018

@theotherphil could you try using nightly and see if you have the same problem. It would be good to know the details of your setup - the code you're working on, platform, etc.

@Geobert
Copy link

Geobert commented Feb 1, 2018

I tried stable and nightly, on https://github.com/cobalt-org/cobalt.rs
tried this as well https://github.com/Geobert/rusty_flexi

tried a brand new cargo init project, it works

@nrc
Copy link
Member

nrc commented Feb 1, 2018

@Geobert sorry, to clarify: it did not work on the two GitHub projects, but did work on a fresh project? Or it worked on all three?

@Geobert
Copy link

Geobert commented Feb 1, 2018

@nrc Bear with me, my English is quite sloppy sometime (French).
The 2 Github project fail for me.

It works with a fresh project.
Maybe some dependencies?

Is there a way to enable more logs from RLS? I don't have the "Rust Language Server" item in the output dropdown.

@kdy1
Copy link

kdy1 commented Feb 3, 2018

Maybe rust-lang/rust#47981? rls does not work if your code contains nested generic like Option<Box<T>>. For a workaround, you can use Option<(Box<T>)>.

@Geobert
Copy link

Geobert commented Feb 3, 2018

I don't know, it work before on stable and I found some nested generics, but they were here for a long time already :-/

@theotherphil
Copy link
Author

theotherphil commented Feb 4, 2018

@nrc I've tried updating VS Code and reinstalling the RLS plugin (0.3.2).

First attempt: RLS would not start:

Couldn't start client Rust Language Server
Could not install RLS component (rls-preview).

I've tried with both the rustc source and imageproc

This was using the following version of Rust:

$ rustup show
Default host: x86_64-apple-darwin

installed toolchains

stable-x86_64-apple-darwin
nightly-x86_64-apple-darwin (default)

active toolchain

nightly-x86_64-apple-darwin (default)
rustc 1.25.0-nightly (97520ccb1 2018-01-21)

I then ran rustup update, and now RLS will start but still fails to find any definitions. New version of rust:

$ rustup show
Default host: x86_64-apple-darwin

installed toolchains

stable-x86_64-apple-darwin
nightly-x86_64-apple-darwin (default)

active toolchain

nightly-x86_64-apple-darwin (default)
rustc 1.25.0-nightly (3d292b793 2018-02-03)

Here are all the VS Code settings that include 'rust' in the name:

// Rust channel to install RLS from.
  "rust-client.channel": "nightly",

  // When set to true, RLS stderr is logged to a file at workspace root level. Requires reloading extension after change.
  "rust-client.logToFile": false,

  // Specifies message severity on which the output channel will be revealed. Requires reloading extension after change.
  "rust-client.revealOutputChannelOn": "never",

  // Name of the RLS rustup component.
  "rust-client.rls-name": "rls-preview",

  // Path to rustup executable
  "rust-client.rustupPath": "rustup",

  // Update the RLS whenever the extension starts up.
  "rust-client.updateOnStartup": false,

  // Enable all Cargo features.
  "rust.all_features": false,

  // if `rust.workspace_mode` is enabled, only the specified package in the workspace will be analyzed.
  "rust.analyze_package": null,

  // Specify to run analysis as if running `cargo check --bin <name>`. Use `null` to auto-detect.
  "rust.build_bin": null,

  // Specify to run analysis as if running `cargo check --lib`. Use `null` to auto-detect.
  "rust.build_lib": null,

  // Only index the project when a file is saved and not on change.
  "rust.build_on_save": false,

  // Build cfg(test) code.
  "rust.cfg_test": false,

  // Clear the RUST_LOG environment variable before running rustc or cargo.
  "rust.clear_env_rust_log": true,

  // A list of Cargo features to enable.
  "rust.features": [],

  // Use racer as a fallback for goto def.
  "rust.goto_def_racer_fallback": false,

  // Do not enable default Cargo features.
  "rust.no_default_features": false,

  // Flags added to RUSTFLAGS.
  "rust.rustflags": null,

  // Show warnings.
  "rust.show_warnings": true,

  // --sysroot
  "rust.sysroot": null,

  // --target
  "rust.target": null,

  // Enable unstable features.
  "rust.unstable_features": false,

  // Don't index crates on the crate blacklist.
  "rust.use_crate_blacklist": true,

  // Time in milliseconds between receiving a change notification and starting build.
  "rust.wait_to_build": 500,

  // EXPERIMENTAL: Enable workspace support and analyze every package in it.
  "rust.workspace_mode": false,

If I override rust.goto_def_racer_fallback to true then go to definition works in some cases, presumably using racer. However, not always. For example, I can't go to the definition of the sess field from TyCtxt.

@Geobert
Copy link

Geobert commented Feb 15, 2018

I can confirm the behaviour if I set rust.goto_def_racer_fallback to true
And still broken with both:

  • stable-x86_64-pc-windows-msvc updated - rustc 1.24.0 (4d90ac38c 2018-02-12)
  • nightly-x86_64-pc-windows-msvc updated - rustc 1.25.0-nightly (3ec5a99aa 2018-02-14)

@Pierre-Green
Copy link

Hello, any update on this ?

@Geobert
Copy link

Geobert commented Feb 22, 2018

@nrc
Copy link
Member

nrc commented Feb 22, 2018

@PieerotGG see rust-lang/vscode-rust#185 (comment) for an update

@Pierre-Green
Copy link

Ok thanks you :)

@fuszenecker
Copy link

There are some issues with RLS again.
It doesn't work with nightly-x86_64-unknown-linux-gnu unchanged - rustc 1.26.0-nightly (c9334404f 2018-03-05)

@nrc
Copy link
Member

nrc commented Mar 8, 2018

@fuszenecker Could you provide some more details please? How is it not working? Is it crashing or features are missing? Go to def or code completion? On some projects or all projects? Could you share the code you're working on and also your platform and any other details please?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

7 participants