all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Vincenzo Pupillo <v.pupillo@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 71771@debbugs.gnu.org
Subject: bug#71771: 31.0.50; [PATCH] php-ts-mode: jsdoc support in javascript
Date: Thu, 27 Jun 2024 21:44:59 +0200	[thread overview]
Message-ID: <2053843.Jadu78ljVU@fedora> (raw)
In-Reply-To: <2140364.9o76ZdvQCi@fedora>

[-- Attachment #1: Type: text/plain, Size: 939 bytes --]

In data giovedì 27 giugno 2024 12:29:40 CEST, Vincenzo Pupillo ha scritto:
> In data giovedì 27 giugno 2024 11:45:54 CEST, Eli Zaretskii ha scritto:
> > > From: Vincenzo Pupillo <v.pupillo@gmail.com>
> > > Date: Tue, 25 Jun 2024 11:52:20 +0200
> > > 
> > > this patch add support for embedding jsdoc into inline javascript
> > > element.
> > 
> > Thanks, but is this for the master branch or for the emacs-30 release
> > branch?  Where was php-ts-mode broken?
> 
> Hi Eli,
> this is for the master branch.
> jsdoc is not available in emacs-30.
> Thanks.
> V.
php-ts-mode was broken because the js--treesit-font-lock-settings variable now 
contains rules for jsdoc, a parser that php-ts-mode did not use.
I fixed the patch because, as I wrote for bug 71776, the jsdoc parser is 
local, just like the phpdoc parser.
 The screenshot I attach is the result of this patch and the two from bug 
71776.

Thanks.
Vincenzo

[-- Attachment #2: 0001-Add-jsdoc-support-to-php-ts-mode-in-script-element.patch --]
[-- Type: text/x-patch, Size: 2520 bytes --]

From 03eca8bd6cb19871e6ac86fb2559088a9a0fd8a9 Mon Sep 17 00:00:00 2001
From: Vincenzo Pupillo <v.pupillo@gmail.com>
Date: Tue, 25 Jun 2024 11:29:54 +0200
Subject: [PATCH] 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.

* lisp/progmodes/php-ts-mode.el (php-ts-mode):
Add jsdoc parser check and a new rule for treesit-range-settings.

* lisp/progmodes/php-ts-mode.el: Updated the commentary section.
---
 lisp/progmodes/php-ts-mode.el | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lisp/progmodes/php-ts-mode.el b/lisp/progmodes/php-ts-mode.el
index 826c131ca70..1298b39311b 100644
--- a/lisp/progmodes/php-ts-mode.el
+++ b/lisp/progmodes/php-ts-mode.el
@@ -36,6 +36,7 @@
 ;; * https://github.com/tree-sitter/tree-sitter-php
 ;; * https://github.com/tree-sitter/tree-sitter-html
 ;; * https://github.com/tree-sitter/tree-sitter-javascript
+;; * https://github.com/tree-sitter/tree-sitter-jsdoc
 ;; * https://github.com/tree-sitter/tree-sitter-css
 ;; * https://github.com/claytonrcarter/tree-sitter-phpdoc
 ;;
@@ -86,6 +87,7 @@ php-ts-mode--language-source-alist
     (phpdoc . ("https://github.com/claytonrcarter/tree-sitter-phpdoc"))
     (html . ("https://github.com/tree-sitter/tree-sitter-html"  "v0.20.3"))
     (javascript . ("https://github.com/tree-sitter/tree-sitter-javascript" "v0.21.2"))
+    (jsdoc . ("https://github.com/tree-sitter/tree-sitter-jsdoc" "v0.21.0"))
     (css . ("https://github.com/tree-sitter/tree-sitter-css" "v0.21.0")))
   "Treesitter language parsers required by `php-ts-mode'.
 You can customize this variable if you want to stick to a specific
@@ -1296,6 +1298,7 @@ php-ts-mode
             (treesit-ready-p 'phpdoc)
             (treesit-ready-p 'html)
             (treesit-ready-p 'javascript)
+            (treesit-ready-p 'jsdoc)
             (treesit-ready-p 'css)))
       (error "Tree-sitter for PHP isn't
     available.  You can install the parsers with M-x
@@ -1334,6 +1337,12 @@ php-ts-mode
                     (start_tag (tag_name))
                     (raw_text) @cap))
 
+                 :embed 'jsdoc
+                 :host 'javascript
+                 :local t
+                 `(((comment) @cap
+                    (:match ,js--treesit-jsdoc-beginning-regexp @cap)))
+
                  :embed 'css
                  :host 'html
                  :offset '(1 . -1)
-- 
2.45.2


[-- Attachment #3: php_with_jsdoc_20240627_152341.png --]
[-- Type: image/png, Size: 27659 bytes --]

  reply	other threads:[~2024-06-27 19:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-25  9:52 bug#71771: 31.0.50; [PATCH] php-ts-mode: jsdoc support in javascript Vincenzo Pupillo
2024-06-27  9:45 ` Eli Zaretskii
2024-06-27 10:29   ` Vincenzo Pupillo
2024-06-27 19:44     ` Vincenzo Pupillo [this message]
2024-06-28  0:52     ` Dmitry Gutov
2024-06-28  8:00       ` Vincenzo Pupillo
2024-06-29 12:09         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2053843.Jadu78ljVU@fedora \
    --to=v.pupillo@gmail.com \
    --cc=71771@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.