|
|
@ -106,8 +106,11 @@ fn calculate_indentation(node: Option<Node>, newline: bool) -> usize {
|
|
|
|
let parent_kind = parent.kind();
|
|
|
|
let parent_kind = parent.kind();
|
|
|
|
let start = parent.start_position().row;
|
|
|
|
let start = parent.start_position().row;
|
|
|
|
|
|
|
|
|
|
|
|
// println!(
|
|
|
|
// detect deeply nested indents in the same line
|
|
|
|
// "name: {}\tparent: {}\trange:\t{} {}\tfirst={:?}\tlast={:?} start={} prev={}",
|
|
|
|
let starts_same_line = start == prev_start;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// log::error!(
|
|
|
|
|
|
|
|
// "name: {}\tparent: {}\trange:\t{} {}\tfirst={:?}\tlast={:?} start={} prev={} same_line={}",
|
|
|
|
// node.kind(),
|
|
|
|
// node.kind(),
|
|
|
|
// parent.kind(),
|
|
|
|
// parent.kind(),
|
|
|
|
// node.range().start_point,
|
|
|
|
// node.range().start_point,
|
|
|
@ -116,14 +119,11 @@ fn calculate_indentation(node: Option<Node>, newline: bool) -> usize {
|
|
|
|
// node.next_sibling().is_none(),
|
|
|
|
// node.next_sibling().is_none(),
|
|
|
|
// node.start_position(),
|
|
|
|
// node.start_position(),
|
|
|
|
// prev_start,
|
|
|
|
// prev_start,
|
|
|
|
|
|
|
|
// starts_same_line
|
|
|
|
// );
|
|
|
|
// );
|
|
|
|
|
|
|
|
|
|
|
|
// detect deeply nested indents in the same line
|
|
|
|
if outdent.contains(&node.kind()) && !starts_same_line {
|
|
|
|
let starts_same_line = start == prev_start;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if outdent.contains(&node.kind()) {
|
|
|
|
|
|
|
|
// we outdent by skipping the rules for the current level and jumping up
|
|
|
|
// we outdent by skipping the rules for the current level and jumping up
|
|
|
|
// println!("skipping..");
|
|
|
|
|
|
|
|
// node = parent;
|
|
|
|
// node = parent;
|
|
|
|
increment -= 1;
|
|
|
|
increment -= 1;
|
|
|
|
// continue;
|
|
|
|
// continue;
|
|
|
|