Skip to content

clean up free-font-lock-settings #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions php-ts-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@
"PHP keywords for tree-sitter font-locking.")

(defvar php-ts-mode--operators
'(("!=" "!==" "%" "%=" "&" "&&" "&=" "*" "**" "*="
'("!=" "!==" "%" "%=" "&" "&&" "&=" "*" "**" "*="
"+" "++" "+=" "," "-" "-" "--" "-=" "->" "."
".=" "/" "/=" ":" "::" "<" "<<" "<<=" "<=" "<=>"
"<>" "=" "==" "===" "=>" ">" ">=" ">>" ">>=" "?"
"??" "??=" "?->" "@" "\\" "^" "^=" "|" "|=" "||"))
"??" "??=" "?->" "@" "\\" "^" "^=" "|" "|=" "||")
"PHP operators for tree-sitter font-locking.")

(defconst php-ts-mode--magical-constants
Expand Down Expand Up @@ -202,22 +202,17 @@ the available version of Tree-sitter for PHP."
]
@font-lock-string-face)

:language 'php
:feature 'interpolation
`((interpolation "${" @font-lock-misc-punctuation-face)
(interpolation "}" @font-lock-misc-punctuation-face))

:language 'php
:feature 'operator
`([,@php-ts-mode--operators] @font-lock-operator-face)

:language 'php
:feature 'string
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: this was a duplicate

`((string) @font-lock-string-face)
:feature 'keyword
`([,@php-ts-mode--keywords] @font-lock-keyword-face)

:language 'php
:feature 'keyword
`([,@php-ts-mode--keywords] @font-lock-keyword-face))
:feature 'bracket
`((["(" ")" "[" "]" "{" "}"]) @font-lock-bracket-face))
"Tree-sitter font-lock settings for `php-ts-mode'.")

(defun php-ts-mode--defun-name (node)
Expand Down Expand Up @@ -283,9 +278,8 @@ Return nil if there is no name or if NODE is not a defun node."
(setq-local treesit-font-lock-settings php-ts-mode--font-lock-settings)
(setq-local treesit-font-lock-feature-list
'((comment definition preprocessor)
(constant keyword string type variables)
(annotation expression literal function)
(bracket delimiter operator)))
(keyword string type variables)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should think about value levels. I suggest we do it as a follow up when we stabilise types that we want to use. I put it in a checklist in #8

(function bracket operator)))

;; Imenu.
(setq-local treesit-simple-imenu-settings
Expand Down