rust-lang / rust-lang/rust-analyzer

Support for Macros (Leptos)

Open
#14,045 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Leptos currently uses cfg_if! macros and when having something like

 cfg_if! {
     if #[cfg(feature = "ssr")] {
       // First Main function
        pub fn main() {
            println!("cargo-leptos is not enabled. Please enable it in your Cargo.toml");
        }
    }
    else {
       // Second Main FUnction 
        pub fn main() {
            println!("cargo-leptos is not enabled. Please enable it in your Cargo.toml");
        }
    }
}

it does not support the first one even if i type something random that has no function or anything it will not produce any errors

rust-analyzer version: rust-analyzer version: 0.3.1377-standalone (daa0138e4 2023-01-21)

rustc version: rustc 1.68.0-nightly (0fb8b72ce 2023-01-06)

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

Start by reproducing the reported Leptos cfg_if! example with the listed rust-analyzer and rustc versions, then compare behavior for the two cfg branches and for invalid code inside the macro. Done means rust-analyzer reports the expected errors and supports both branches in an updated minimal reproduction.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.