Skip to content

Commit

Permalink
[language-php] Highlight null-safe property access correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
savetheclocktower committed Sep 19, 2024
1 parent 433cf8f commit 22a23ed
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/language-php/grammars/tree-sitter/queries/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -302,21 +302,33 @@
; The "bar" in `$foo->bar()`.
(member_call_expression
name: (name) @support.other.function.method.php)
(nullsafe_member_call_expression
name: (name) @support.other.function.method.php)

; The "bar" in `$foo->bar`.
(member_access_expression
name: (name) @support.other.property.php
(#set! capture.final true))
(nullsafe_member_access_expression
name: (name) @support.other.property.php
(#set! capture.final true))

; The "$bar" in `$foo->$bar()`.
(member_call_expression
name: (variable_name) @variable.other.method.php
(#set! capture.final true))
(nullsafe_member_call_expression
name: (variable_name) @variable.other.method.php
(#set! capture.final true))

; The "$bar" in `$foo->$bar`.
(member_access_expression
name: (variable_name) @variable.other.property.php
(#set! capture.final true))
; The "$bar" in `$foo->$bar`.
(nullsafe_member_access_expression
name: (variable_name) @variable.other.property.php
(#set! capture.final true))

; The "Foo" in `new Foo();`.
(object_creation_expression
Expand Down Expand Up @@ -638,6 +650,7 @@
] @keyword.operator.assignment.compound.php

"->" @keyword.operator.class.php
"?->" @keyword.operator.class.null-safe.php
"=>" @punctuation.separator.key-value.php

"\\" @keyword.operator.namespace.php
Expand Down

0 comments on commit 22a23ed

Please sign in to comment.