diff --git a/admin/tree-sitter/treesit-admin.el b/admin/tree-sitter/treesit-admin.el index 2be6fe42f27..2e85d6b0d8c 100644 --- a/admin/tree-sitter/treesit-admin.el +++ b/admin/tree-sitter/treesit-admin.el @@ -83,6 +83,7 @@ go-ts-mode heex-ts-mode html-ts-mode + mhtml-ts-mode java-ts-mode js-ts-mode json-ts-mode @@ -107,6 +108,7 @@ go-ts-mode heex-ts-mode html-ts-mode + mhtml-ts-mode java-ts-mode js json-ts-mode diff --git a/etc/NEWS b/etc/NEWS index c06be2301d4..79d124bd585 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -931,6 +931,12 @@ option controls how much is indented for method chaining. ** PHP-ts mode +--- +*** 'php-ts-mode' now depends on 'mhtml-ts-mode'. +The direct dependency on js-ts-mode, css-ts-mode and html-ts-mode has +now been replaced by ‘mhtml-ts-mode’. Navigation, Outline and Imenu +work for all languages and code maintenance is easier. + --- *** 'php-ts-mode-run-php-webserver' can now accept a custom "php.ini" file. You can use the new optional argument CONFIG when calling @@ -939,6 +945,34 @@ the built-in Web server. Interactively, when invoked with a prefix argument, 'php-ts-mode-run-php-webserver' prompts for the config file as well as for other connection parameters. +--- +*** The option 'php-ts-mode-css-fontify-colors' has been removed. +'mhtml-ts-mode-css-fontify-colors' replaces this option. + +--- +*** New user option 'php-ts-mode-html-relative-indent'. +In buffers containing both PHP and HTML, this option allows you to +define how the PHP code should be indented relative to the position of +the HTML tags. + +--- +*** New user option 'php-ts-mode-html-indent-offset'. +Offset of PHP code block relative to HTML tags. + +--- +*** New user option 'php-ts-mode-find-sibling-rules'. +Rules for finding siblings of a PHP file. + +--- +*** New user option 'php-ts-mode-phpdoc-highlight-errors'. +When non nil, it highlights unknown PHPDOC tags using +'font-lock-warning-face' so that the user can identify them more easily. + +--- +*** New command 'php-ts-mode-show-ini'. +Show the location of the PHP ini files, if the buffer is associated to a remote +PHP file show the remote PHP ini files. + ** Rust-ts mode --- diff --git a/lisp/progmodes/php-ts-mode.el b/lisp/progmodes/php-ts-mode.el index a01e4d66fba..d45226ad5e9 100644 --- a/lisp/progmodes/php-ts-mode.el +++ b/lisp/progmodes/php-ts-mode.el @@ -25,12 +25,12 @@ ;;; Tree-sitter language versions ;; ;; php-ts-mode has been tested with the following grammars and version: -;; - tree-sitter-phpdoc: v0.1.5 +;; - tree-sitter-phpdoc: v0.1.6 ;; - tree-sitter-css: v0.23.1-1-g6a442a3 ;; - tree-sitter-jsdoc: v0.23.2 ;; - tree-sitter-javascript: v0.23.1-2-g108b2d4 ;; - tree-sitter-html: v0.23.2-1-gd9219ad -;; - tree-sitter-php: v0.23.11 +;; - tree-sitter-php: v0.23.12 ;; ;; We try our best to make builtin modes work with latest grammar ;; versions, so a more recent grammar has a good chance to work too. @@ -42,7 +42,7 @@ ;; for editing PHP files with embedded HTML, JavaScript, CSS and phpdoc. ;; Tree Sitter is used to parse each of these languages. ;; -;; Please note that this package requires `html-ts-mode', which +;; Please note that this package requires `mhtml-ts-mode', which ;; registers itself as the major mode for editing HTML. ;; ;; This package is compatible and has been tested with the following @@ -69,9 +69,7 @@ (require 'treesit) (require 'c-ts-common) ;; For comment indent and filling. -(require 'html-ts-mode) ;; for embed html -(require 'css-mode) ;; for embed css into html -(require 'js) ;; for embed javascript into html +(require 'mhtml-ts-mode) ;; For embed html, css and js. (require 'comint) (treesit-declare-unavailable-functions) @@ -83,10 +81,10 @@ ;;; Install treesitter language parsers (defvar php-ts-mode--language-source-alist '((php "https://github.com/tree-sitter/tree-sitter-php" - :commit "43aad2b9a98aa8e603ea0cf5bb630728a5591ad8" - :source-dir "php/src") + :commit "f7cf7348737d8cff1b13407a0bfedce02ee7b046" + :source-dir "php/src") (phpdoc "https://github.com/claytonrcarter/tree-sitter-phpdoc" - :commit "fe3202e468bc17332bec8969f2b50ff1f1da3a46")) + :commit "03bb10330704b0b371b044e937d5cc7cd40b4999")) "Treesitter language parsers required by `php-ts-mode'. You can customize `treesit-language-source-alist' if you want to stick to a specific commit and/or use different parsers.") @@ -97,9 +95,10 @@ to stick to a specific commit and/or use different parsers.") (defun php-ts-mode-install-parsers () "Install all the required treesitter parsers. `treesit-language-source-alist' defines which parsers to install. -It's pre-filled by loading \"html-ts-mode\", \"css-mode\", \"js\"." +It's pre-filled by loading \"mhtml-ts-mode\"." (interactive) - (dolist (lang '(php phpdoc html css javascript jsdoc)) + (mhtml-ts-mode-install-parsers) + (dolist (lang '(php phpdoc)) (treesit-install-language-grammar lang))) ;;; Custom variables @@ -118,25 +117,63 @@ It's pre-filled by loading \"html-ts-mode\", \"css-mode\", \"js\"." (defcustom php-ts-mode-js-css-indent-offset 2 "JavaScript and CSS indent spaces related to the