Skip to content

Rust-analyzer doesn't integrate bindings in workspace #196

@vwkd

Description

@vwkd

IntelliSense with rust-analyzer is broken in a workspace. The bindings in target/bindings are generated, but when expanding the macro recursively they aren't.

Steps To Reproduce

  1. Create workspace with one library crate. Minimal example: cargo-component-rust-analyzer-workspace.
  2. Open repo in VSCode.
  3. Confirm bindings are generated in target/bindings/foo/bindings.rs automatically by rust-analyzer.
  4. Confirm no IntelliSense when cursor is placed over api::Guest trait in foo/src/lib.rs#L6.
  5. Confirm running command "rust analyzer: Expand macro recursively at caret" gives empty bindings when cursor is placed over cargo_component_bindings::generate!() macro in foo/src/lib.rs#L1.

Versions

  • VSCode 1.84.2
  • rust-analyzer extension v0.3.1740
  • cargo-component package 0.4.1

Additional Information

The same issue occurs to me sometimes in a non-workspace library crate, but I can't reproduce it reliably. It seems like some random combination of restarting rust-analyzer, deleting the target directory, and changing Cargo.toml can fix it, and also break it again.

Continued from #139 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions