Skip to content

Commit 4725968

Browse files
authored
Merge pull request #6 from piotrkwiecinski/syntax-hightlighting
syntax highlighting
2 parents 2c20fe5 + ef29ab2 commit 4725968

File tree

1 file changed

+27
-10
lines changed

1 file changed

+27
-10
lines changed

php-ts-mode.el

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
'("abstract" "as" "break" "case" "catch" "class" "const"
7575
"continue" "declare" "default" "do" "echo" "else"
7676
"elseif" "enddeclare" "endforeach" "endif" "endswitch"
77-
"endwhile" "extends" "final" "finally" "foreach"
77+
"endwhile" "enum" "extends" "final" "finally" "foreach"
7878
"function" "global" "if" "implements" "include_once"
7979
"include" "insteadof" "interface" "namespace" "new"
8080
"private" "protected" "public" "require_once" "require"
@@ -118,14 +118,31 @@ the available version of Tree-sitter for PHP."
118118

119119
:language 'php
120120
:feature 'type
121-
`((primitive_type) @font-lock-type-face
122-
(cast_type) @font-lock-type-face
123-
(named_type (name) @type) @font-lock-type-face
124-
(named_type (qualified_name) @type) @font-lock-type-face
125-
(boolean) @font-lock-type-face
126-
(null) @php-constant
127-
(integer) @font-lock-number-face
128-
(float) @font-lock-number-face)
121+
`([(primitive_type)
122+
(cast_type)
123+
(named_type (name) @type)
124+
(named_type (qualified_name) @type)
125+
(namespace_use_clause)
126+
(namespace_name (name))
127+
(class_interface_clause (name))
128+
(const_element (name))
129+
(boolean)] @font-lock-type-face
130+
(null) @php-constant
131+
[(integer)
132+
(float)] @font-lock-number-face)
133+
134+
:language 'php
135+
:feature 'definition
136+
`((class_declaration
137+
name: (name) @font-lock-type-face)
138+
(interface_declaration
139+
name: (name) @font-lock-type-face)
140+
(enum_declaration
141+
name: (name) @font-lock-type-face)
142+
(trait_declaration
143+
name: (name) @font-lock-type-face)
144+
(enum_case
145+
name: (name) @font-lock-type-face))
129146

130147
:language 'php
131148
:feature 'function
@@ -267,7 +284,7 @@ Return nil if there is no name or if NODE is not a defun node."
267284
(setq-local treesit-font-lock-feature-list
268285
'((comment definition preprocessor)
269286
(constant keyword string type variables)
270-
(annotation expression literal)
287+
(annotation expression literal function)
271288
(bracket delimiter operator)))
272289

273290
;; Imenu.

0 commit comments

Comments
 (0)