Skip to content

Conversation

Copy link

Copilot AI commented Jan 22, 2026

STweep formatter strips indentation from empty lines within code blocks, causing Codesys IDE to misinterpret block boundaries and break code collapse functionality.

Changes

  • Added bug report template at .github/ISSUE_TEMPLATE/sweep_bug_report.md following STweep's official format
  • Documented repro case showing 6-line block incorrectly collapsing as 3-line block after formatting
  • Included version info: STweep 4.2.1, Codesys 3.5.21.30

Issue Illustration

Before formatting (collapses correctly as single 6-line block):

// parent instruction
	// step 1
	// step 2
	// step 3
	
	// step 4
	// step 5
// end of parent instruction

After formatting (empty line loses tab, splits into 3-line block + orphaned lines):

// parent instruction
	// step 1
	// step 2
	// step 3

	// step 4
	// step 5
// end of parent instruction
Original prompt

Generate a bug report for the pluggin STweep, using their bug report template where you describe this behaviour:

Original code:

// parent instruction
	// step 1
	// step 2
	// step 3
	
	// step 4
	// step 5
// end of parent instruction

The expected result is that when you collapse that code, you get this:

// parent instruction [6 lines]
// end of parent instruction

After formatting, the plugin will remove the tabs/spaces in the empty lines, returning:

// parent instruction
	// step 1
	// step 2
	// step 3

	// step 4
	// step 5
// end of parent instruction

Causing that when you try to collapse the parent instruction in Codesys, you'll get:

// parent instruction [3 lines]

	// step 4
	// step 5
// end of parent instruction

As can be seen, the IDE infers that these are two different blocks of code, breaking the hierarchy.

IDE: Codesys 3.5.21.30
STweep for Codesys version 4.2.1


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: HighWolf <7592241+HighWolf@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix collapsing behavior for parent instructions in STweep Document STweep formatter bug: empty line indentation removal breaks code folding Jan 22, 2026
Copilot AI requested a review from HighWolf January 22, 2026 00:24
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.

2 participants