rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.31k stars 1.62k forks source link

No signatures shown in completion popup #18504

Open traviscross opened 1 week ago

traviscross commented 1 week ago

The issue reported here...

...is a regression triggered by a change in r-a. I've bisected it to commit ba1c9146fcca65fa9c40d1e4e73bdcb898a8de46 ("Omit completion fields to be resolved later").

This was part of PR:

This is not fixed by the recent PR:

This regression has made it into beta, and if there is a fix here on the r-a side, we'll probably want to beta-backport that.

See also:

cc @SomeoneToIgnore @Veykril @lnicola

traviscross commented 1 week ago

There's been a request on Zulip for details to help a non-Emacs user reproduce this. Here are those details.

Using podman, docker, or your favorite similar tool, create a clean container, install Emacs, install Rust, and minimally configure Emacs:

podman run -ti --rm fedora:41

# Within the container...

# Install Emacs, Rust, and rust-analyzer.
dnf install -y emacs-nw rustup
rustup-init -y
. $HOME/.cargo/env
cd ~
git clone https://github.com/rust-lang/rust-analyzer.git
cd rust-analyzer
git checkout ba1c9146fcca65fa9c40d1e4e73bdcb898a8de46
cargo xtask install --server

# Configure Emacs minimally for lsp-mode.
cat > ~/.emacs <<'EOF'
(setq package-archives
      '(("gnu" . "https://elpa.gnu.org/packages/")
        ("melpa" . "https://melpa.org/packages/")))

(use-package rust-mode :ensure)
(use-package company :ensure)
(use-package lsp-mode :ensure
  :config
  (add-hook 'rust-mode-hook 'lsp-mode))
(use-package yasnippet :ensure
  :config
  (add-hook 'lsp-mode-hook 'yas-minor-mode))
EOF

# Create a project and start Emacs.
cd ~
cargo new playground
cd playground
emacs src/main.rs

Now wait patiently while the dependencies are installed. When done:

Now edit the file to contain:

fn main() {
    "".// Cursor here.
}

The resulting popup will not contain method signatures.

Press C-x C-c (that is, Ctrl-x followed by Ctrl-c) to exit Emacs.

If you then back up r-a by one commit, i.e.:

cd ~/rust-analyzer
git checkout HEAD^
cargo xtask install --server

Then you will get a different and correct result when retesting in Emacs.