Skip to content

Unknown types in web-sys dependency #4150

Closed
@eminence

Description

@eminence

(I suspect this is a duplicate, but i'm not sure what the root cause is).

I'm trying to use the web-sys crate, which is highly generated.

I've enabled both loadOutDirsFromCheck and procMacro.enable:

.vscode/settings.jon
{
    "rust-analyzer.cargo.loadOutDirsFromCheck": true,
    "rust-analyzer.procMacro.enable": true,
    "editor.tokenColorCustomizationsExperimental": {
        "unresolvedReference": "#FF0000"
    }
}
Cargo.toml
[package]
name = "foo"
version = "0.1.0"
authors = ["Andrew Chin <[email protected]>"]
edition = "2018"

[dependencies.web-sys]
version = "0.3"
features = ["Document", "Window"]

Code:

use web_sys::{Document, Window};

pub fn foo() {
    let win: Window = web_sys::window().unwrap();
    let doc: Document = win.document().unwrap();
}

image

Using RA nightly (fe99a29)

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macromacro expansion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions