diff options
author | Alan Du <[email protected]> | 2019-01-04 18:36:31 +0000 |
---|---|---|
committer | Alan Du <[email protected]> | 2019-01-04 18:39:43 +0000 |
commit | fae89605547d684d39e0065fc4286f8608428d5f (patch) | |
tree | 4ebcfc610ab44465e2bc1ab8f3e9d77dd32981b1 /crates/ra_editor/src | |
parent | a0d483011d5f84747fcc5d5fe9c82f4405d24db9 (diff) |
Remove extra space when joining lines in use items
Diffstat (limited to 'crates/ra_editor/src')
-rw-r--r-- | crates/ra_editor/src/typing.rs | 19 |
1 files changed, 19 insertions, 0 deletions
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 | |||
256 | fn compute_ws(left: SyntaxNodeRef, right: SyntaxNodeRef) -> &'static str { | 256 | fn compute_ws(left: SyntaxNodeRef, right: SyntaxNodeRef) -> &'static str { |
257 | match left.kind() { | 257 | match left.kind() { |
258 | L_PAREN | L_BRACK => return "", | 258 | L_PAREN | L_BRACK => return "", |
259 | L_CURLY => { | ||
260 | if let USE_TREE = right.kind() { | ||
261 | return ""; | ||
262 | } | ||
263 | } | ||
259 | _ => (), | 264 | _ => (), |
260 | } | 265 | } |
261 | match right.kind() { | 266 | match right.kind() { |
@@ -331,6 +336,20 @@ fn foo() { | |||
331 | } | 336 | } |
332 | 337 | ||
333 | #[test] | 338 | #[test] |
339 | fn test_join_lines_use_items() { | ||
340 | // No space after the '{' | ||
341 | check_join_lines( | ||
342 | r" | ||
343 | <|>use ra_syntax::{ | ||
344 | TextUnit, TextRange, | ||
345 | };", | ||
346 | r" | ||
347 | <|>use ra_syntax::{TextUnit, TextRange, | ||
348 | };", | ||
349 | ); | ||
350 | } | ||
351 | |||
352 | #[test] | ||
334 | fn test_join_lines_use_tree() { | 353 | fn test_join_lines_use_tree() { |
335 | check_join_lines( | 354 | check_join_lines( |
336 | r" | 355 | r" |