Skip to content

Code reformatting breaks injection SQL #347

@xterao

Description

@xterao

When placing the cursor inside a text block that contains injected SQL in a Java file and executing "Reformat Code", the formatting of the injected content breaks.
Only the PreProcessor logic appears to be applied, and the expected full formatting is not performed.

Before:

	@Select
	@Sql("""
			SELECT * FROM a
			""")
	Emp selectInjection5();
Image

Formatted:

	@Select
	@Sql("""
			SELECT *
		 FROM a 
			""")
	Emp selectInjection5();

However, if the cursor is placed outside the text block (e.g., in the surrounding Java code), and the file is formatted, this issue does not occur — the injected SQL is formatted correctly as intended.

This suggests that the formatter behavior differs based on cursor position, and the full formatter is not triggered properly when invoked from inside the injected content.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions