Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/isamert/jsdoc.el

Insert JSDoc comments easily with Emacs
https://github.com/isamert/jsdoc.el

emacs javascript jsdoc

Last synced: 3 days ago
JSON representation

Insert JSDoc comments easily with Emacs

Awesome Lists containing this project

README

        

#+TITLE: jsdoc.el

[[https://melpa.org/#/jsdoc][file:https://melpa.org/packages/jsdoc-badge.svg]]

This package provides an easy way to insert [[https://jsdoc.app/][JSDoc]] function comments and typedefs. It leverages a variety of techniques to generate documentation as much as possible without human interaction, including type inference and other similar approaches.

Also has basic TypeScript support, using [[https://tsdoc.org/][TSDoc]] style.

[[file:./jsdoc.gif]]

Please note that this package is only compatible with Emacs 29 or newer versions that support tree-sitter. If you are using Emacs 28 or an earlier version, please refer to the [[https://github.com/isamert/jsdoc.el/tree/emacs-28-and-below][emacs-28-and-below]] branch, which utilizes the [[https://github.com/ubolonton/emacs-tree-sitter][tree-sitter]] package.

* Usage
To use this package, you can call the interactive command =jsdoc=. If your cursor is on a function definition, the command will insert a JSDoc-style function documentation comment. If your cursor is on a JavaScript object, the command will insert a JSDoc =@typedef= comment.

* Installation
jsdoc is available through [[https://melpa.org/#/jsdoc][MELPA]]. If you have it set up already, just do ~M-x package-install jsdoc~ and you are good to go. Otherwise please see [[https://melpa.org/#/getting-started][MELPA getting started]] page to learn how you can install packages through MELPA or see the following installation options.

Alternatively, you can use the [[https://github.com/radian-software/straight.el][straight]] or [[https://github.com/quelpa/quelpa-use-package][quelpa]] package managers in conjunction with ~use-package~.

#+begin_src emacs-lisp
;; Using straight
(use-package jsdoc
:straight (:host github :repo "isamert/jsdoc.el"))

;; Using quelpa
(use-package jsdoc
:quelpa (jsdoc :fetcher github :repo "isamert/jsdoc.el"))
#+end_src

* Similar packages
- [[https://github.com/ananthakumaran/tide][ananthakumaran/tide]] :: The command =tide-jsdoc-template= inserts a JSDoc template for your function. It's meant to be simple, no advanced stuff. It also requires ~tide-mode~ enabled (which runs ~tsserver~).
- [[https://github.com/mooz/js-doc][mooz/js-doc]] :: Another package in the spirit of this one. Seems to have quite advanced stuff but didn't get it to work. Haven't got updated for a while.