on master help sign in
Fix issues with "enum A {|}" <Enter> indent calculation.
commit63e602bda6e6c4381372880f4313aec46170044d authorBlaž Hrastnik <blaz@mxxn.io> dateWed 7 Apr 2021, 16:39 (6 years ago) parent4103349
1 file changed+7−7
helix-core/src/indent.rs+7−7
helix-core/src/indent.rs+7−7
@@ -106,8 +106,11 @@ fn calculate_indentation(node: Option<Node>, newline: bool) -> usize {
106106 let parent_kind = parent.kind();
107107 let start = parent.start_position().row;
108108
109− // println!(
110− // "name: {}\tparent: {}\trange:\t{} {}\tfirst={:?}\tlast={:?} start={} prev={}",
109+ // detect deeply nested indents in the same line
110+ let starts_same_line = start == prev_start;
111+
112+ // log::error!(
113+ // "name: {}\tparent: {}\trange:\t{} {}\tfirst={:?}\tlast={:?} start={} prev={} same_line={}",
111114 // node.kind(),
112115 // parent.kind(),
113116 // node.range().start_point,
@@ -116,14 +119,11 @@ fn calculate_indentation(node: Option<Node>, newline: bool) -> usize {
116119 // node.next_sibling().is_none(),
117120 // node.start_position(),
118121 // prev_start,
122+ // starts_same_line
119123 // );
120124
121− // detect deeply nested indents in the same line
122− let starts_same_line = start == prev_start;
123−
124− if outdent.contains(&node.kind()) {
125+ if outdent.contains(&node.kind()) && !starts_same_line {
125126 // we outdent by skipping the rules for the current level and jumping up
126− // println!("skipping..");
127127 // node = parent;
128128 increment -= 1;
129129 // continue;