isamert / jsdoc.el Goto Github PK
View Code? Open in Web Editor NEWInsert JSDoc comments easily with Emacs
License: GNU General Public License v3.0
Insert JSDoc comments easily with Emacs
License: GNU General Public License v3.0
It looks like a neato package and I'd love to try it out.
When I try to use the package, as shown in the README, I get a Wrong type argument: user-ptrp, nil
error.
Any assistance would be appreciated.
Continuing the discussion about JSDoc syntax highlighting:
While working on this I thought it would be nice to have some syntax highlighting for jsdoc blocks. There actualls is a grammer for JSDoc. I tried using it but my understanding for tree-sitter is still very limited. As far as I understood it, one has to set ranges for each parser to act upon.. this would mean we need to patch js-ts-mode upstream to implement those ranges... or am I understanding it wrong? Maybe you have a better grasp on it.
Nice idea! I don't really know how
*-ts-mode
's work, so I looked a bit forjs-ts-mode
and from my understanding:
- First, we need to define
treesit-font-lock-settings
usingtreesit-font-lock-rules
.- Then we need to update
js--treesit-font-lock-setting
to something like the following.This is the default:
(defvar js--treesit-font-lock-settings (treesit-font-lock-rules :language 'javascript :feature 'comment '((comment) @font-lock-comment-face) ...Documentation says instead of a face, we can give a function:
(defvar js--treesit-font-lock-settings (treesit-font-lock-rules :language 'javascript :feature 'comment `((comment) (lambda (node override start end &rest _) <somehow fontify the region with jsdoc-ts font lock settings?>) ...The part in angle brackets might be something like this:
(let ((treesit-font-lock-settings <font lock settings we defined for jsdoc-ts>)) (treesit-font-lock-fontify-region start end))These are just a mild guess, not quite sure if this is the right way or even if it works or not. I might try when I get a chance.
I don't think the upstream patch would be accepted because not everyone uses JSDoc in their comments. What can be done is simply overriding
js--treesit-font-lock-settings
with a newly defined one or something similar that has the same effect.
I will take a more closer looking into your suggestions when I have time. This issue can serve as a discussion basis.
I love the idea of this package. With the new typescript-ts-mode and eglot in 29 a lot of what tide offers is already in Emacs. However it seems like this package doesn't support TypeScript. Here was the result of me adding docs to a function:
/**
*
* @param {nil} nil -
* @param {nil} nil -
* @returns {number} -
*/
function test(param1: string, param2: number): number {
return 0;
}
Are there any plans to support TypeScript? I doubt TypeScript users care much about the type annotations.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.