Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using jsDoc in Notepad++

I use notepad++ for my JavaScript development now. I am wondering if anyone has successfully integrated jsDoc with notepad++ for easy code commenting.

I was usint Aptana earlier and it was already integrated in it as ScriptDoc I believe but Aptana grew out to be painfully slow.

like image 430
Rajat Avatar asked Apr 04 '10 21:04

Rajat


People also ask

What is JSDoc used for?

JSDoc is a markup language used to annotate JavaScript source code files. Using comments containing JSDoc, programmers can add documentation describing the application programming interface of the code they're creating.

How do you write comments in JSDoc?

JSDoc comments should generally be placed immediately before the code being documented. Each comment must start with a /** sequence in order to be recognized by the JSDoc parser. Comments beginning with /* , /*** , or more than 3 stars will be ignored.


2 Answers

It it is possible to get jsDoc to work using the NppExec plugin. The steps are pretty straightforward, and should be a lot more straightforward after you read this.

  1. In NPP (I'm using v. 5.9.3) open the plugin manager
  2. Install NppExec plugin. (Npp restarts, I believe)
  3. Go to the NppExec menu under plugins, choose the "Execute" menu option. A tiny scripting window opens.
  4. Enter the following NppExec scriptlet:

NPP_SAVE
cls
SET jsDocPath = e:\javascript\jsdoc
cmd /c if "$(EXT_PART)"==".js" echo "Running JSDoc" && $(jsDocPath)\jsDocMe.cmd $(jsDocPath) "$(FULL_CURRENT_PATH)" "$(CURRENT_DIRECTORY)\jsDoc"
NPP_CONSOLE 0

(the line beginning with cmd and the following line should all appear on one line...)

Explanation: The set command sets a variable for where your jsDoc path is. The cmd line first checks to see if the currently open file has a .js extension, and if so it calls a .cmd file called jsDocMe.cmd, text below, passing in the jsDocPath, the full path of the current file, and the directory of the current file. The use of these variables can be seen in the .cmd file. The text of the .cmd file is below, a simple set of batch commands that changes to the jsDoc directory, runs the jsrun.jar file, and sends output to a new jsDoc folder beneath the current working directory.

cd /D %1
java -jar jsrun.jar app\run.js -d=%3 -a -p -t=templates/jsdoc %2 
%3\index.html
exit
like image 189
Chris van Hasselt Avatar answered Sep 17 '22 16:09

Chris van Hasselt


Notepad++ uses Scintilla, which does not parse inside comments, so I doubt there would be any plugins doing this. (See the comments for this feature request.)

like image 39
Tgr Avatar answered Sep 19 '22 16:09

Tgr