From fae89605547d684d39e0065fc4286f8608428d5f Mon Sep 17 00:00:00 2001 From: Alan Du Date: Fri, 4 Jan 2019 13:36:31 -0500 Subject: Remove extra space when joining lines in use items --- crates/ra_editor/src/typing.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'crates') diff --git a/crates/ra_editor/src/typing.rs b/crates/ra_editor/src/typing.rs index dd3d0f260..5876f9e20 100644 --- a/crates/ra_editor/src/typing.rs +++ b/crates/ra_editor/src/typing.rs @@ -256,6 +256,11 @@ fn join_single_use_tree(edit: &mut TextEditBuilder, node: SyntaxNodeRef) -> Opti fn compute_ws(left: SyntaxNodeRef, right: SyntaxNodeRef) -> &'static str { match left.kind() { L_PAREN | L_BRACK => return "", + L_CURLY => { + if let USE_TREE = right.kind() { + return ""; + } + } _ => (), } match right.kind() { @@ -330,6 +335,20 @@ fn foo() { ); } + #[test] + fn test_join_lines_use_items() { + // No space after the '{' + check_join_lines( + r" +<|>use ra_syntax::{ + TextUnit, TextRange, +};", + r" +<|>use ra_syntax::{TextUnit, TextRange, +};", + ); + } + #[test] fn test_join_lines_use_tree() { check_join_lines( -- cgit v1.2.3