Skip to content

Formater breaks on some coderegions #172

@Mewlkor

Description

@Mewlkor

Code regions inside functions can cause the formater to not indent correctly. When the coderegion is not indented to the "correct" indentation level it moves all code after that to the indentation level of the coderegion. This breaks even more should the coderegion be inside a if/for or similar indentaion.

Its a bit hard to discribe but this is a MRP for the issue. Since coderegion tags are just comments this is perfectly valid gdscript.

extends Node

func _ready() -> void:
	var some_var = 1
	var some_var2 = 2
	
#region unused code
	#var some_var = 1
	#var some_var2 = 2
#endregion
	print(some_var * some_var2)
	print("This should not be indeted")

func test():
	var some_var = 1
	var some_var2 = 2
	if true:
#region unused code
	#var some_var = 1
	#var some_var2 = 2
#endregion
		print(some_var * some_var2)
		print("This should not be indeted")

Metadata

Metadata

Assignees

No one assigned

    Labels

    upstreamThe issue (likely) can't be solved in this repository: a library needs a change

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions