From ec8a2e49bae788a98147bbfaff460f12e29b5901 Mon Sep 17 00:00:00 2001 From: Vincenzo Pupillo Date: Mon, 25 Nov 2024 11:06:02 +0100 Subject: [PATCH] Improved support for PHP 8.4 and more reliable indentation. Added support for PHP 8.4 property hook. More reliable CSS and Javascript syntax indentation and highlighting. * lisp/progmodes/php-ts-mode.el (php-ts-mode--language-source-alist): Switch to the latest php grammar. (php-ts-mode--js-css-tag-bol): CSS and Javascript indentation is now more more reliable in different formatting styles. (php-ts-mode--test-property-hook-clause-p): New function that tests property_hook support. (php-ts-mode--font-lock-settings): Use the new function. (php-ts-mode--colorize-css-value): The function now behaves exactly like the one in css-ts-mode. (php-ts-mode--feature-list): Changed the list to match css-ts-mode. --- lisp/progmodes/php-ts-mode.el | 48 +++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/lisp/progmodes/php-ts-mode.el b/lisp/progmodes/php-ts-mode.el index f9fd03cbf72..d090c068d31 100644 --- a/lisp/progmodes/php-ts-mode.el +++ b/lisp/progmodes/php-ts-mode.el @@ -84,7 +84,7 @@ ;;; Install treesitter language parsers (defvar php-ts-mode--language-source-alist - '((php . ("https://github.com/tree-sitter/tree-sitter-php" "v0.23.5" "php/src")) + '((php . ("https://github.com/tree-sitter/tree-sitter-php" "v0.23.11" "php/src")) (phpdoc . ("https://github.com/claytonrcarter/tree-sitter-phpdoc")) (html . ("https://github.com/tree-sitter/tree-sitter-html" "v0.23.0")) (javascript . ("https://github.com/tree-sitter/tree-sitter-javascript" "v0.23.0")) @@ -477,16 +477,20 @@ php-ts-mode--first-sibling (treesit-node-start parent) (line-end-position)))))) -(defun php-ts-mode--js-css-tag-bol (node _parent &rest _) +(defun php-ts-mode--js-css-tag-bol (_node parent &rest _) "Find the first non-space characters of html tags