File tree Expand file tree Collapse file tree 4 files changed +68
-28
lines changed
Expand file tree Collapse file tree 4 files changed +68
-28
lines changed Original file line number Diff line number Diff line change 192192 (comment)
193193 (region_start)
194194 (region_end)
195- (annotation)] @allow_blank_line_before )
195+ (annotation)
196+ (function_definition)
197+ (class_definition)
198+ (constructor_definition)] @allow_blank_line_before )
196199
197200(setget) @prepend_indent_start @append_indent_end
198201(setget ":" @prepend_antispace )
Original file line number Diff line number Diff line change @@ -166,7 +166,7 @@ impl Formatter {
166166 // - must contain at least one new line character between `extends_name` and optional doc comment
167167 // - may contain multiple doc comment lines that starts with `##` and ends with a new line character
168168 let re = RegexBuilder :: new (
169- r#"(?P<extends_line>^extends )(?P<extends_name>([a-zA-Z0-9]+|".*?"))\n+(?P<doc>(?:^##.*\n)*) \n*(?P<EOF>\z)?"# ,
169+ r#"(?P<extends_line>^extends )(?P<extends_name>([a-zA-Z0-9]+|".*?"))\n+(( ?P<doc>(?:^##.*\n)+)(?:\z|\n))? \n*(?P<EOF>\z)?"# ,
170170 )
171171 . multi_line ( true )
172172 . build ( )
Original file line number Diff line number Diff line change 1- class_name Player
21extends CharacterBody2D
3- ## A brief description of the class's role and functionality.
2+ ## Blankline after docstring
43##
54## The description of script
65
7- class_name Player
6+ var a = 10
87extends CharacterBody2D
9- ## A brief description of the class's role and functionality.
8+ ## Blankline before and after docstring
109##
1110## The description of script
1211
13- class_name Player
12+ var a = 10
1413extends CharacterBody2D
15- ## A brief description of the class's role and functionality.
14+
15+ ## Blankline before docstring
1616##
17- ## The description of script
17+ ## The description of a variable
18+ var a = 10
19+ extends CharacterBody2D
1820
21+ ## No blankline around docstring
22+ ##
23+ ## The description of a variable
1924var a = 10
20- class_name Player
2125extends CharacterBody2D
22- ## A brief description of the class's role and functionality.
26+
27+ ## Blanklink before function docstring
28+ ##
29+ ## The description of a variable
30+ func foo ():
31+ pass
32+ extends CharacterBody2D
33+ ## Blankline between docstring and function definition
2334##
24- ## The description of script
35+ ## The description of a variable
36+
37+ func foo ():
38+ pass
39+ extends CharacterBody2D
2540
2641var a = 10
27- class_name Player
2842extends CharacterBody2D
29- ## A brief description of the class's role and functionality.
3043
3144var a = 10
45+ extends CharacterBody2D
46+ ## Docstring at the end of file
47+ ##
48+ ## The description of script
Original file line number Diff line number Diff line change 1- class_name Player extends CharacterBody2D
2-
3- ## A brief description of the class's role and functionality.
4- ##
5- ## The description of script
6- class_name Player extends CharacterBody2D
7- ## A brief description of the class's role and functionality.
1+ extends CharacterBody2D
2+ ## Blankline after docstring
83##
94## The description of script
10- class_name Player extends CharacterBody2D
11- ## A brief description of the class's role and functionality.
5+
6+ var a = 10
7+ extends CharacterBody2D
8+
9+ ## Blankline before and after docstring
1210##
1311## The description of script
1412
1513var a = 10
16- class_name Player
1714extends CharacterBody2D
1815
19- ## A brief description of the class's role and functionality.
16+ ## Blankline before docstring
2017##
21- ## The description of script
18+ ## The description of a variable
19+ var a = 10
20+ extends CharacterBody2D
21+ ## No blankline around docstring
22+ ##
23+ ## The description of a variable
24+ var a = 10
25+ extends CharacterBody2D
26+ ## Blanklink before function docstring
27+ ##
28+ ## The description of a variable
29+ func foo ():
30+ pass
31+ extends CharacterBody2D
32+ ## Blankline between docstring and function definition
33+ ##
34+ ## The description of a variable
35+
36+ func foo ():
37+ pass
38+ extends CharacterBody2D
2239
2340var a = 10
24- class_name Player
2541extends CharacterBody2D
26- ## A brief description of the class's role and functionality.
2742var a = 10
43+
44+ extends CharacterBody2D
45+ ## Docstring at the end of file
46+ ##
47+ ## The description of script
You can’t perform that action at this time.
0 commit comments