Skip to content

Commit 24b4578

Browse files
committed
default statement indent + font rules
1 parent 52c5ac0 commit 24b4578

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

php-ts-mode.el

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
((parent-is "binary_expression") parent-bol, 0)
8989
((parent-is "switch_block") parent-bol ,offset)
9090
((parent-is "case_statement") parent-bol ,offset)
91+
((parent-is "default_statement") parent-bol ,offset)
9192
((parent-is "assignment_expression") parent-bol ,offset)
9293
((parent-is "return_statement") parent-bol ,offset))))
9394
"Tree-sitter indent rules.")
@@ -161,6 +162,10 @@ see https://www.php.net/manual/language.constants.predefined.php")
161162
@php-constant))
162163
(class_constant_access_expression
163164
(name) @php-class)
165+
(class_constant_access_expression
166+
(qualified_name
167+
(namespace_name_as_prefix) @php-class
168+
(name) @php-class))
164169
[(boolean)
165170
(null)]
166171
@php-constant
@@ -180,7 +185,8 @@ see https://www.php.net/manual/language.constants.predefined.php")
180185
name: (name) @php-class)
181186
(enum_case
182187
name: (name) @php-class)
183-
(base_clause (name) @php-class))
188+
(base_clause (name) @php-class)
189+
(use_declaration (name) @php-class))
184190

185191
:language 'php
186192
:feature 'function
@@ -194,6 +200,8 @@ see https://www.php.net/manual/language.constants.predefined.php")
194200
scope: (name) @php-class)
195201
(scoped_call_expression
196202
name: (name) @php-static-method-call)
203+
(scoped_property_access_expression
204+
scope: (name) @php-class)
197205
(member_call_expression
198206
name: (name) @php-method-call)
199207
(object_creation_expression (name) @php-class)

tests/php-ts-mode-resources/indent.erts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,19 @@ class Test
105105
}
106106
}
107107
=-=-=
108+
109+
Name: Switch
110+
111+
=-=
112+
<?php
113+
114+
public function test()
115+
{
116+
switch ($cond) {
117+
case 1:
118+
return 1;
119+
default:
120+
return 2;
121+
}
122+
}
123+
=-=-=

0 commit comments

Comments
 (0)