rust-lang / rust-lang/rust-analyzer

Support to force #[cfg(foo)]

Open
#12,059 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

In my program I have many conditionally compiled blocks of code using #[cfg(foo)]. Important note, these are not features. They do not look like #[cfg(feature="foo")]. As it stands there is no way to force rust analyzer to set this cfg.

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 tracing how rust-analyzer obtains and applies cfg settings, comparing support for #[cfg(feature="foo")] with bare #[cfg(foo)]. Done means users can configure arbitrary cfg names and rust-analyzer correctly analyzes the corresponding conditional blocks.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.