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

no autocomplete for &str argument named str in fn #924

Open
zesty opened this issue Sep 8, 2021 · 4 comments
Open

no autocomplete for &str argument named str in fn #924

zesty opened this issue Sep 8, 2021 · 4 comments

Comments

@zesty
Copy link

zesty commented Sep 8, 2021

fn nothing(str: &str) -> String {
    str.split_w  // no autocomplete
    "foo".spl  // autocomplete works here
}

related? #649

version: v0.7.8
rls
rust-analyzer nightly

installed toolchains

stable-x86_64-unknown-linux-gnu (default)
nightly-x86_64-unknown-linux-gnu

active toolchain

stable-x86_64-unknown-linux-gnu (default)
rustc 1.54.0 (a178d0322 2021-07-26)

5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

@lnicola
Copy link
Member

lnicola commented Sep 8, 2021

You shouldn't use both rls and rust-analyzer, and if you want to use the latter, install the standalone extension.

FWIW, your test case works there:

image

@zesty
Copy link
Author

zesty commented Sep 8, 2021

Sorry, wasn't looking too closely when pasting info. Don't think I changed any of that from the default settings:

Rust-client: Engine
The underlying LSP server used to provide IDE support for Rust projects. ----> rls

Rust › Rust-analyzer: Release Tag
Which binary release to download and use ----> nightly

I think it is not using rust-analyzer; no rust-analyzer in ~/.cargo/bin.

only rust stuff in settings.json:

    "[rust]": {
        "editor.defaultFormatter": "statiolake.vscode-rustfmt",
        "editor.formatOnSave": true
    },
    "rust.cfg_test": true,
    "rust.clippy_preference": "on

@zesty
Copy link
Author

zesty commented Sep 9, 2021

Appears to be a conflict with recognition of primitives. When I change the arg name to sr, then I get autocomplete. The popup for plain str is just a path:

/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/primitive_docs.rs

Should I chalk this up to "don't name variables after types", even though it appears to work in rust-analyzer per @lnicola?

@zesty zesty changed the title no autocomplete for &str argument in fn no autocomplete for &str argument named str in fn Sep 9, 2021
@lnicola
Copy link
Member

lnicola commented Sep 9, 2021

It's a proper bug and it can be fixed, but see https://rust-lang.github.io/rfcs/2912-rust-analyzer.html.

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

No branches or pull requests

2 participants