From: Vincenzo Pupillo <v.pupillo@gmail.com>
To: 71771@debbugs.gnu.org
Subject: bug#71771: 31.0.50; [PATCH] php-ts-mode: jsdoc support in javascript
Date: Tue, 25 Jun 2024 11:52:20 +0200 [thread overview]
Message-ID: <9865475.eNJFYEL58v@3-191.divsi.unimi.it> (raw)
[-- Attachment #1: Type: text/plain, Size: 171 bytes --]
Hi,
this patch add support for embedding jsdoc into inline javascript element.
Thanks
Vincenzo
p.s. Damien's patch broke php-ts-mode if jsdoc parser is not installed.
[-- Attachment #2: 0001-Add-jsdoc-support-to-php-ts-mode-in-script-element.patch --]
[-- Type: text/x-patch, Size: 2500 bytes --]
From 31e4f30c4a7f867e1bb690a0f53918326b7aaa00 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 | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/lisp/progmodes/php-ts-mode.el b/lisp/progmodes/php-ts-mode.el
index 826c131ca70..8eade9ef112 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,11 @@ php-ts-mode
(start_tag (tag_name))
(raw_text) @cap))
+ :embed 'jsdoc
+ :host 'javascript
+ `(((comment) @capture
+ (:match ,js--treesit-jsdoc-beginning-regexp @capture)))
+
:embed 'css
:host 'html
:offset '(1 . -1)
--
2.45.2
next reply other threads:[~2024-06-25 9:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-25 9:52 Vincenzo Pupillo [this message]
2024-06-27 9:45 ` bug#71771: 31.0.50; [PATCH] php-ts-mode: jsdoc support in javascript Eli Zaretskii
2024-06-27 10:29 ` Vincenzo Pupillo
2024-06-27 19:44 ` Vincenzo Pupillo
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9865475.eNJFYEL58v@3-191.divsi.unimi.it \
--to=v.pupillo@gmail.com \
--cc=71771@debbugs.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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).