Giter Site home page Giter Site logo

js-doc's Introduction

js-doc

Insert JSDoc style comment easily in Emacs

Installation

  1. Put js-doc.el somewhere in your emacs load path.
  2. Add a line below to your .emacs file:
(require 'js-doc)

Example

Paste the codes below into your configuration file and you:

  1. insert function document by pressing Ctrl + c, i
  2. insert @tag easily by pressing @ in the JSDoc style comment

If you want to see the tag description, just input the next command M-x js-doc-describe-tag

Configuration

(setq js-doc-mail-address "your email address"
       js-doc-author (format "your name <%s>" js-doc-mail-address)
       js-doc-url "url of your website"
       js-doc-license "license name")

 (add-hook 'js2-mode-hook
           #'(lambda ()
               (define-key js2-mode-map "\C-ci" 'js-doc-insert-function-doc)
               (define-key js2-mode-map "@" 'js-doc-insert-tag)))

js-doc's People

Contributors

blaenk avatar mooz avatar syohex avatar yasuyk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

js-doc's Issues

does not work for variation of function declaration styles. Eg JSX/React/class style functions

most of my functions are in form

function funcName (attr1, attr2)
{
return attr1;
}

or

var RClassNm = React.CreateClass({

getState: function ()
{
}

});

The js-doc module does not appear to work for any of them.

When I type M-x js-doc-insert-function-doc
I see comments appearing with a body of another function up in the file.

I use emacs 25.0.93.1 Fedora 23 Linux
And I have installed a number of Javascript related helpers that understand Syntax structure of javascript files very well

 (setq flycheck-checkers '(javascript-eslint))
  ;; use eslint with web-mode for jsx files
  (flycheck-add-mode 'javascript-eslint 'web-mode)
  (flycheck-add-mode 'javascript-eslint 'js2-mode)
  (flycheck-add-mode 'javascript-eslint 'js-mode)
  ;; disable json-jsonlist checking for json files
  (setq-default flycheck-disabled-checkers
                (append flycheck-disabled-checkers
                        '(json-jsonlist)))
  )

I suspect the regex based methods within js-lint prevent it from working in the above scenarios.

stable release

Seems like it's pretty stable for you. How about a v1.0.0 tag for melpa stable?

Function doc always inserted at beginning of file

Running spacemacs & 25.2.2.

When I run the command js-doc-insert-function-doc or js-doc-insert-function-doc-snippet these snippets are always inserted at the beginning of the file.

The following code should reproduce this issue:

function myTestFunction(paramA, paramB)) {
}

const myTestFunctionTwo = (paramA, paramB) => {
}

When entering either function and running the above commands, the doc snippet will always be added at the top of the file.

Use emacs default author variables

The variables js-doc-mail-address and js-doc-author are practically copies of user-mail-address and user-full-name. It's not much effort to copy them in the configuration, but it seems redundant.

syntax highlighting

would be great to add some font-lock configuration to have syntax highlight inside jsdoc comments.

Keywords are already known and listed on variables and should not be hard to get regexps from them, the only possible tricky part would be to only apply font-lock o element inside jsdoc comments /** */ as it is going to be used as a minor mode and should not affect other fonts.

Also may need some work coloring arguments or similar stuff that is not a keyword but live in some specific positions, but for a first implementation also simple keyword highlighting would be a really good starting point.

I do not have experience in this field, but I guess some logic may be extracted from js2-mode however it can't be a full copy-paste as I think on js2-mode they are not using font-lock but their specific syntax highlighting engine

`js-doc-insert-function-doc` causes Emacs to hang

With js-doc 0.0.5, invoking js-doc-insert-function-doc on a file containing only the following causes Emacs 24.5.50.1 to hang.

function foo(bar){

}

Strangely, if js-doc-insert-file-doc is called first, this problem does not occur.

complaints about iswitchb mode being obsolete

Hi,

I've been noticing that emacs complains every time I insert js-doc that iswitchb mode is obsolete

Package iswitchb is obsolete!
You can run the command `js-doc-insert-function-doc' with C-c i

see: https://www.emacswiki.org/emacs/IswitchBuffers

A quick search of this repo shows that it isn't an upstream problem, but rather this code uses it in js-doc.el:

(require 'iswitchb)

I don't know enough about emacs lisp to be helpful beyond this bug report

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.