Commit graph

26 commits

Author SHA1 Message Date
Vincenzo Pupillo
84fc77f34f Remove unnecessary function call from 'php-ts-mode'
* lisp/progmodes/php-ts-mode.el (php-ts-mode): Remove
unnecessary function call 'treesit-font-lock-recompute-features'.
(Bug#74688)

(cherry picked from commit c87c5b95e1)
2024-12-07 15:17:35 +02:00
Vincenzo Pupillo
9fdb764898
Support PHP 8.4 and more reliable indentation (bug#74525)
Added support for PHP 8.4 property hook. More reliable CSS and
Javascript syntax indentation when there are attributes in
<script> and <style>.

* 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.
2024-11-28 20:47:22 -08:00
Yuan Fu
50b91ed458
Remove mention of treesit-defun-prefer-top-level (bug#74474)
treesit-defun-prefer-top-level is removed before Emacs 29
released and was replaced by treesit-defun-tactic.  These
statements that set it doesn't do anything other than introduce
confusion, so we should remove them.

* lisp/progmodes/c-ts-mode.el (c-ts-base-mode):
* lisp/progmodes/js.el (js-ts-mode):
* lisp/progmodes/php-ts-mode.el (php-ts-mode):
* lisp/progmodes/ruby-ts-mode.el (ruby-ts-mode):
* lisp/progmodes/typescript-ts-mode.el:
(typescript-ts-base-mode):
Remove statements setting treesit-defun-prefer-top-level.
2024-11-24 17:07:37 -08:00
Vincenzo Pupillo
f69f54c454 Improve font-locking and indentation in 'php-ts-mode'
* lisp/progmodes/php-ts-mode.el (php-ts-mode--language-source-alist):
Updated to latest version of PHP grammar.
(php-ts-mode--indent-styles): 'namespace_use_declaration' is now
correctly indented.
(php-ts-mode--operators): Support of the "argument unpacking
operator".
(php-ts-mode--font-lock-settings): 'nullsafe_member_call_expression'
is now highlighted correctly.
(php-ts-mode--comment-indent-new-line): Delete trailing whitespace
before inserting newline (see bug#73900 for more information).
Bug#74239
2024-11-14 10:47:51 +02:00
Stefan Kangas
67a27ff53b ; Fix typos 2024-10-27 07:49:32 +01:00
Vincenzo Pupillo
0d8d5f10ff Highlight namespace name in "use" clause.
* lisp/progmodes/php-ts-mode.el (php-ts-mode--font-lock-settings):
New rule to highlight namespace name in "use" clause.  (Bug#73975)
2024-10-24 18:38:25 +03:00
Vincenzo Pupillo
4e0cb960db Fix 'php-ts-mode': better indentation and font locking
Incomplete compound_statement or colon_block (statement-group
without a closing brace or closing keyword) that are not inside
a function or method are not recognized as such by tree-sitter-php.
A new function 'php-ts-mode--open-statement-group-heuristic'
handles this case.  Font locking of magic methods and better
support for alternative control structure syntax.
Support for latest grammar version.
* lisp/progmodes/php-ts-mode.el
(php-ts-mode--language-source-alist): Updated grammar version.
(php-ts-mode--possibly-braceless-keyword-re): Regular expression
for braceless keyword.
(php-ts-mode--open-statement-group-heuristic): New function.
(php-ts-mode--parent-html-bol): Use the new function and doc fix.
(php-ts-mode--parent-html-heuristic): Use the new function and doc
fix.
(php-ts-mode--indent-styles): Use the new function and add
'colon_block' support.
(php-ts-mode--class-magic-methods): New predefined magic methods
list.
(php-ts-mode--test-namespace-name-as-prefix-p): Doc fix.
(php-ts-mode--test-namespace-aliasing-clause-p): Fix the test and
doc.
(php-ts-mode--test-namespace-use-group-clause-p): Doc fix.
(php-ts-mode--test-visibility-modifier-operation-clause-p): New
function for the new asymmetric property visibility feature of
PHP 8.4.
(php-ts-mode--font-lock-settings): Font lock for class magic methods
and alternative syntax.  Better font lock for 'instanceof'.  Use
'font-lock-function-call-face' for scoped and member call expression.
(bug#73779)
2024-10-19 16:11:32 +03:00
Eli Zaretskii
e2b01d164c ; Fix last changes in php-ts-mode.el
* lisp/progmodes/php-ts-mode.el
(php-ts-mode--test-namespace-name-as-prefix-p)
(php-ts-mode--test-namespace-aliasing-clause-p)
(php-ts-mode--test-namespace-use-group-clause-p): Doc fixes.
(treesit-query-compile): Declare.
2024-09-28 15:06:44 +03:00
Vincenzo Pupillo
69d8f9d1b7
Fix php-ts-mode font-lock for latest PHP grammar (bug#73516)
Version 0.23 of the PHP grammar introduced some changes that
affect the font lock.

* lisp/progmodes/php-ts-mode.el
(php-ts-mode--language-source-alist): Update php, html, js and css
grammars version.
(php-ts-mode--parent-html-heuristic): Fix docstring
(php-ts-mode--test-namespace-name-as-prefix-p): New function.
(php-ts-mode--test-namespace-aliasing-clause-p): New function.
(php-ts-mode--test-namespace-use-group-clause-p): New function.
(php-ts-mode--font-lock-settings): Use the new functions.
2024-09-28 01:06:41 -07:00
Vincenzo Pupillo
3129315587
Improve php-ts-mode font lock and support latest grammar (bug#72796)
* lisp/progmodes/php-ts-mode.el:
(php-ts-mode--language-source-alist): Update the parser version.
(php-ts-mode--parent-html-heuristic): Fix commentary.
(php-ts-mode--keywords): Add "exit" keyword.
(php-ts-mode--predefined-constant): Added math constant.
(php-ts-mode--font-lock-settings): New and improved rules.
2024-08-26 00:48:35 -07:00
john muhl
7093504da2 ; Fix typos (bug#72167)
* lisp/minibuffer.el (completion-auto-deselect): Correct
spelling of "minibuffer".
* lisp/progmodes/peg.el (peg--actions): Correct spelling
of "post-processing".
* lisp/progmodes/php-ts-mode.el: Correct spelling of
"taken".
2024-07-18 08:23:13 +03:00
Vincenzo Pupillo
736b7cad40 Add jsdoc support to php-ts-mode in <script> element
In the <script> element, enable jsdoc embedding in JavaScript.
* lisp/progmodes/php-ts-mode.el
(php-ts-mode--language-source-alist): Add jsdoc to parser recipe.
(php-ts-mode): Add jsdoc parser check and a new rule for
'treesit-range-settings'.  Update the commentary section.
(Bug#71771)
2024-06-29 15:06:59 +03:00
Vincenzo Pupillo
d5c6eb1f96 Doc fix in 'php-ts-mode'
* lisp/progmodes/php-ts-mode.el
(php-ts-mode--custom-html-font-lock-settings): Doc fix.  (Bug#71759)
2024-06-27 01:47:27 +02:00
Stefan Kangas
fb11294d41 ; Fix typos 2024-06-23 16:40:06 +02:00
Eli Zaretskii
6f2036243f ; Doc fix in 'php-ts-mode'.
* lisp/progmodes/php-ts-mode.el (php-ts-mode-css-fontify-colors):
Doc fix.
2024-06-23 08:01:28 +03:00
Vincenzo Pupillo
2f1c882a16 Colorize CSS property value like `css--fontify-region'
If the value of a property is text representing a CSS color,
it will be fontified such that its background is the color
itself. 'php-ts-mode-css-fontify-colors' can be used to
disable this behaviour.
* lisp/progmodes/php-ts-mode.el (php-ts-mode-css-fontify-colors):
New custom var.
* lisp/progmodes/php-ts-mode.el (php-ts-mode--colorize-css-value):
New function.
* lisp/progmodes/php-ts-mode.el (php-ts-mode): Use the new
function.  (Bug#71724)
2024-06-23 07:57:52 +03:00
Vincenzo Pupillo
737fa7c529 Fix 'Customize' menu entry for 'php-ts-mode'
* lisp/progmodes/php-ts-mode.el (php-ts-mode-menu):
Replace menu entry with 'php-ts-mode' group.  (Bug#71723)
2024-06-23 07:50:55 +03:00
Vincenzo Pupillo
155cc89de0 Support for indentation of PHP alternative syntax control structures
For some control structures, PHP provides an alternative syntax.
A new rule has been added to handle this syntax.
* lisp/progmodes/php-ts-mode.el (php-ts-mode--indent-styles):
New rule for PHP alternative syntax.  (Bug#71710)
2024-06-22 12:42:10 +03:00
Vincenzo Pupillo
a4fe4ca93c Fix font lock regex for user defined constant in PHP
The old regex also captured functions with two or more
uppercase characters.  This new regex fixes that issue.
* lisp/progmodes/php-ts-mode.el (php-ts-mode--font-lock-settings):
New regex that match only user-defined constants.  (Bug#71593)
2024-06-22 11:48:50 +03:00
Stefan Kangas
f18a915690 ; Translate comment to English
* lisp/progmodes/php-ts-mode.el
(php-ts-mode--parent-html-heuristic): Translate comment to English.
2024-06-16 22:38:26 +02:00
Stefan Kangas
c0eefebabf ; Fix typos 2024-06-16 22:38:26 +02:00
Vincenzo Pupillo
13c4fc3dc7 Fix 'wrong-type-argument' in 'php-ts-mode--webserver-read-args'
Prevents php-ts-mode--webserver-read-args from throwing an
error if the current buffer is not associated with a file.
* lisp/progmodes/php-ts-mode.el (php-ts-mode--webserver-read-args):
Use 'default-directory if' the current buffer is not associated
with a file.  (Bug#71574)
(php-ts-mode-run-php-webserver): Fix doc string.
2024-06-15 21:52:45 +03:00
Eli Zaretskii
9b2e1b5e16 Avoid byte-compilation warnings in php-ts-mode
* lisp/progmodes/php-ts-mode.el (treesit-search-forward)
(treesit-node-prev-sibling, treesit-node-first-child-for-pos):
Declare.
2024-06-15 20:03:39 +03:00
Eli Zaretskii
9e8c0ec991 Fix problem with recently-added defcustom's
* lisp/progmodes/php-ts-mode.el (php-ts-mode-php-config)
(php-ts-mode-ws-port, php-ts-mode-ws-document-root)
(php-ts-mode-ws-workers): Fix :type and :safe attributes.
(Bug#71566)
2024-06-15 16:20:01 +03:00
Mattias Engdegård
59367f6a3a php-ts-mode: minor fixes
* lisp/progmodes/php-ts-mode.el (php-ts-mode-flymake-php):
Don't use `any` to mean `not-newline`; it's misleading.
(php-ts-mode--predefined-constant): Remove duplicate "E_USER_NOTICE".
2024-06-13 10:49:28 +02:00
Vincenzo Pupillo
e37754fc59 Add php-ts-mode
* etc/NEWS: Mention the new mode.
* lisp/progmodes/php-ts-mode.el: New file.  (Bug#71380)
2024-06-12 21:22:29 +03:00