Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix precedence order of @align captures in indent computation #8659

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions helix-core/src/indent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,9 @@ impl Indentation {
}

/// Add an indent capture to this indent.
/// All the captures that are added in this way should be on the same line.
/// Only captures that apply to the same line should be added together in this way (otherwise use `add_line`)
/// and the captures should be added starting from the innermost tree-sitter node (currently this only matters
/// if multiple `@align` patterns occur on the same line).
fn add_capture(&mut self, added: IndentCaptureType) {
match added {
IndentCaptureType::Indent => {
Expand All @@ -295,7 +297,9 @@ impl Indentation {
self.outdent = 0;
}
IndentCaptureType::Align(align) => {
self.align = Some(align);
if self.align.is_none() {
self.align = Some(align);
}
}
}
}
Expand Down
Loading