Skip to content

If statement and comment line get dedented in this nested code block #190

Description

@Rubonnek

For some reason, the code block of one specific for-loop in my code is not getting indented properly. A specific if-statement is being pulled outside of the loop's scope.

$ gdscript-formatter --version                                      
gdscript-formatter 0.18.2

Steps to reproduce:

  1. git clone https://github.com/Rubonnek/subtitles-importer
  2. cd subtitles-importer
  3. git checkout 0317672bcd11056c5a79c511a22c877aaf24917f
  4. gdscript-formatter addons/rubonnek.subtitles_importer/subtitles.gd

You'll get the following diff:

diff --git a/addons/rubonnek.subtitles_importer/subtitles.gd b/addons/rubonnek.subtitles_importer/subtitles.gd
index 09965ff..9c4369b 100644
--- a/addons/rubonnek.subtitles_importer/subtitles.gd
+++ b/addons/rubonnek.subtitles_importer/subtitles.gd
@@ -1180,7 +1180,7 @@ func __parse_ssa(p_content: String, p_file_path: String = "", p_remove_html_tags
        for i: int in line_count:
                var line: String = lines[i].strip_edges()
 
-               if line.is_empty() or line[0] == ';':
+       if line.is_empty() or line[0] == ';':
                        continue
 
                # Check for section headers (optimized with direct character access)
@@ -2811,7 +2811,7 @@ func __parse_tmp(p_content: String, p_file_path: String = "", p_remove_html_tags
                                var minutes: int = minutes_str.to_int()
                                var seconds: int = seconds_str.to_int()
 
-                               # Calculate start time in seconds
+       # Calculate start time in seconds
                                var start_time: float = hours * 3600.0 + minutes * 60.0 + seconds
 
                                # Extract text (everything after third colon)
@@ -2884,11 +2884,12 @@ func __parse_tmp(p_content: String, p_file_path: String = "", p_remove_html_tags
 
        return entries

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions