Skip to content

Fix formatting of comments after statements without semicolons - #311

Merged
jgardn3r merged 1 commit into
integrated-application-development:masterfrom
jgardn3r:fix-trailing-comments
Aug 12, 2026
Merged

Fix formatting of comments after statements without semicolons#311
jgardn3r merged 1 commit into
integrated-application-development:masterfrom
jgardn3r:fix-trailing-comments

Conversation

@jgardn3r

@jgardn3r jgardn3r commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

This fixes #243.

@jgardn3r
jgardn3r requested a review from fourls August 7, 2026 01:33
@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.18182% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
core/src/defaults/parser.rs 98.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Comment thread core/src/defaults/parser.rs Outdated
Comment thread core/datatests/generators/logical_line_parser.rs
@jgardn3r
jgardn3r force-pushed the fix-trailing-comments branch from 609a115 to fe6aa83 Compare August 10, 2026 02:51
@jgardn3r
jgardn3r requested a review from fourls August 10, 2026 23:53

@fourls fourls left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good for the most part, but I noticed this behaviour:

begin
  if A then
    //
    begin
    // <- should be +1 indent
    end
    //
  ;
end;

Let's fix + add a test.


I don't think this is related to this change necessarily, but you do also get weird behaviour here:

if A then
  //
  begin
  end;

  // <- should be -1 indent

While it's not grammatically valid (can't have a top level if outside a statement list), it's probably a fixable case of context leakage.

@jgardn3r
jgardn3r requested a review from fourls August 11, 2026 04:20
@jgardn3r

Copy link
Copy Markdown
Collaborator Author
begin
  if A then
    //
    begin
    // <- should be +1 indent
    end
    //
  ;
end;

I was able to locate this class of issue and fix it. It also led me to find that anonymous routines weren't being handled correctly. Both of those things should be fixed now, with tests.


if A then
  //
  begin
  end;

  // <- should be -1 indent

I was unable to reproduce this, so I think it is a non-issue with the additional context of it being technically invalid code.

@fourls fourls left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - just one nit.

Comment thread core/src/defaults/parser.rs Outdated
@jgardn3r
jgardn3r force-pushed the fix-trailing-comments branch from 8aa6cb2 to 1b67893 Compare August 12, 2026 04:15
@jgardn3r
jgardn3r requested a review from fourls August 12, 2026 04:16
@jgardn3r
jgardn3r enabled auto-merge (rebase) August 12, 2026 04:16

@fourls fourls left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@jgardn3r
jgardn3r merged commit 1b13dad into integrated-application-development:master Aug 12, 2026
7 checks passed
@jgardn3r
jgardn3r deleted the fix-trailing-comments branch August 12, 2026 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The code formatting of assignments and double-slash comments is not aligned

2 participants