diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-08-17 09:44:34 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-08-17 09:44:34 -0400 |
| commit | 072cd79a60410d3f2cc3cc5c12b86c461c462e85 (patch) | |
| tree | 641c627fd1a7801850cf425221a5bcde64c9aae8 /src | |
| parent | 6e84221ba93f95a903c3a3afc4820e4a613898ec (diff) | |
Process the rest of the comment group when encountering an odinfmt enable
Diffstat (limited to 'src')
| -rw-r--r-- | src/odin/printer/visit.odin | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/odin/printer/visit.odin b/src/odin/printer/visit.odin index 9784052..e3a7e96 100644 --- a/src/odin/printer/visit.odin +++ b/src/odin/printer/visit.odin @@ -185,15 +185,26 @@ visit_disabled :: proc(p: ^Printer, node: ^ast.Node) -> ^Document { move := cons(move_line(p, pos_one_line_before), escape_nest(move_line(p, node_pos))) - for comment_before_or_in_line(p, disabled_info.end_line + 1) { - next_comment_group(p) - } - p.disabled_until_line = disabled_info.end_line p.source_position = node.end p.source_position.line = disabled_info.end_line - return cons(move, text(disabled_info.text)) + document := cons(move, text(disabled_info.text)) + + for comment_before_or_in_line(p, disabled_info.end_line + 1) { + // we need to handle the rest of the comment group + comment_group := p.comments[p.latest_comment_index] + for comment in comment_group.list { + if comment.pos.line <= disabled_info.end_line { + continue + } + newlined, tmp_document := visit_comment(p, comment) + document = cons(document, tmp_document) + } + next_comment_group(p) + } + + return document } @(private) |