rust-lang / rust-lang/rust-analyzer

Autocompletion for variables not available on wasm32 target

Open
#16,128 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

With the setting target="wasm32-unknown-unknown", rust-analyzer refuses to autocomplete methods on variables. This behavior doesn't happen on the usual x64 target. Here is screenshot of the issue, where it doesn't recognize the window variable defined outside. Similar things happen for the event_loop variable as well.

image

This example is from this small example: https://github.com/mbrc12/rust-analyzer-example/ , compiled using wasm-pack build --target web.

Might this be a setup error from my side? My rust-analyzer settings for this project are here: https://github.com/mbrc12/rust-analyzer-example/blob/main/.nlsp/rust_analyzer.json .

Many thanks for the help!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the missing completion in the mbrc12/rust-analyzer-example project using wasm-pack build --target web, and review .nlsp/rust_analyzer.json alongside the target="wasm32-unknown-unknown" setting. Compare completion behavior with the usual x64 target; done means methods on variables such as window and event_loop are offered for the wasm32 target too.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.