mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-29 06:23:25 +00:00
fix: use 4 spaces for indentation in macro expansion
This commit is contained in:
parent
ce4ae41605
commit
48966268fc
1 changed files with 3 additions and 6 deletions
|
@ -20,7 +20,7 @@ pub fn insert_ws_into(syn: SyntaxNode) -> SyntaxNode {
|
||||||
let after = Position::after;
|
let after = Position::after;
|
||||||
|
|
||||||
let do_indent = |pos: fn(_) -> Position, token: &SyntaxToken, indent| {
|
let do_indent = |pos: fn(_) -> Position, token: &SyntaxToken, indent| {
|
||||||
(pos(token.clone()), make::tokens::whitespace(&" ".repeat(2 * indent)))
|
(pos(token.clone()), make::tokens::whitespace(&" ".repeat(4 * indent)))
|
||||||
};
|
};
|
||||||
let do_ws = |pos: fn(_) -> Position, token: &SyntaxToken| {
|
let do_ws = |pos: fn(_) -> Position, token: &SyntaxToken| {
|
||||||
(pos(token.clone()), make::tokens::single_space())
|
(pos(token.clone()), make::tokens::single_space())
|
||||||
|
@ -41,7 +41,7 @@ pub fn insert_ws_into(syn: SyntaxNode) -> SyntaxNode {
|
||||||
if indent > 0 {
|
if indent > 0 {
|
||||||
mods.push((
|
mods.push((
|
||||||
Position::after(node.clone()),
|
Position::after(node.clone()),
|
||||||
make::tokens::whitespace(&" ".repeat(2 * indent)),
|
make::tokens::whitespace(&" ".repeat(4 * indent)),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
if node.parent().is_some() {
|
if node.parent().is_some() {
|
||||||
|
@ -91,10 +91,7 @@ pub fn insert_ws_into(syn: SyntaxNode) -> SyntaxNode {
|
||||||
LIFETIME_IDENT if is_next(is_text, true) => {
|
LIFETIME_IDENT if is_next(is_text, true) => {
|
||||||
mods.push(do_ws(after, tok));
|
mods.push(do_ws(after, tok));
|
||||||
}
|
}
|
||||||
MUT_KW if is_next(|it| it == SELF_KW, false) => {
|
AS_KW | DYN_KW | IMPL_KW | CONST_KW | MUT_KW => {
|
||||||
mods.push(do_ws(after, tok));
|
|
||||||
}
|
|
||||||
AS_KW | DYN_KW | IMPL_KW | CONST_KW => {
|
|
||||||
mods.push(do_ws(after, tok));
|
mods.push(do_ws(after, tok));
|
||||||
}
|
}
|
||||||
T![;] if is_next(|it| it != R_CURLY, true) => {
|
T![;] if is_next(|it| it != R_CURLY, true) => {
|
||||||
|
|
Loading…
Reference in a new issue