Skip to content

Commit d49fe0b

Browse files
committed
Differentiate between full configs and toml only config groupings
1 parent 5351ac8 commit d49fe0b

File tree

3 files changed

+82
-70
lines changed

3 files changed

+82
-70
lines changed

src/tools/rust-analyzer/crates/ide/src/expand_macro.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,9 @@ fn _format(
177177
use ide_db::base_db::{FileLoader, SourceDatabase};
178178
// hack until we get hygiene working (same character amount to preserve formatting as much as possible)
179179
const DOLLAR_CRATE_REPLACE: &str = "__r_a_";
180-
let expansion = expansion.replace("$crate", DOLLAR_CRATE_REPLACE);
180+
const BUILTIN_REPLACE: &str = "builtin__POUND";
181+
let expansion =
182+
expansion.replace("$crate", DOLLAR_CRATE_REPLACE).replace("builtin #", BUILTIN_REPLACE);
181183
let (prefix, suffix) = match kind {
182184
SyntaxKind::MACRO_PAT => ("fn __(", ": u32);"),
183185
SyntaxKind::MACRO_EXPR | SyntaxKind::MACRO_STMTS => ("fn __() {", "}"),
@@ -206,7 +208,9 @@ fn _format(
206208
let captured_stdout = String::from_utf8(output.stdout).ok()?;
207209

208210
if output.status.success() && !captured_stdout.trim().is_empty() {
209-
let output = captured_stdout.replace(DOLLAR_CRATE_REPLACE, "$crate");
211+
let output = captured_stdout
212+
.replace(DOLLAR_CRATE_REPLACE, "$crate")
213+
.replace(BUILTIN_REPLACE, "builtin #");
210214
let output = output.trim().strip_prefix(prefix)?;
211215
let output = match kind {
212216
SyntaxKind::MACRO_PAT => {

src/tools/rust-analyzer/crates/rust-analyzer/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ always-assert = "0.2.0"
4545
walkdir = "2.3.2"
4646
semver.workspace = true
4747
memchr = "2.7.1"
48-
indexmap = { version = "2.0.0", features = ["serde"] }
48+
indexmap = { workspace = true, features = ["serde"] }
4949

5050
cfg.workspace = true
5151
flycheck.workspace = true

0 commit comments

Comments
 (0)