Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse: task tags in javascript blocks inside html files

Is it possible to enable task tags like //TODO and //FIXME for html files in Eclipse? I've already checked in Eclipse's settings and there is no "Task Tags" section for HTML files. The issue is that I'm not really using these task tags in the html itself; they're in blocks of javascript inside the html files. It would be nice to somehow capture them even though they reside in an html file.

like image 931
Aaron Avatar asked Jun 19 '11 21:06

Aaron


People also ask

Does Eclipse support JavaScript?

The JavaScript Development Tools (JSDT) provide plug-ins that implement an IDE supporting the development of JavaScript applications and JavaScript within web applications. It adds a JavaScript project type and perspective to the Eclipse Workbench as well as a number of views, editors, wizards, and builders.

How do I view JavaScript files in eclipse?

Go to the Outline view. If it is not displayed, go to Window | Show View | Outline. on the Outline view's toolbar and select html. HTML and JavaScript objects contained within the file will be displayed in a tree view.

What are Eclipse tags?

Tag is a snapshot of the project state. You can create a tag of the one specified revision or a tag, containing resources of different revisions.


1 Answers

Unfortunately Eclipse is not able to recognize Task Tags for JavaScript embedded in HTML. You can however use HTML comments to add Task Tags around the blocks of JavaScript. For example:

<!DOCTYPE html>
<html>
 <head>
  <!-- TODO: Add meta tags and page title here. -->
 </head>
 <body>
  <h1>Title</h1>
  <!-- FIXME: There might be a semicolon missing in this code. -->
  <script type="text/javascript">
   // TODO: This comment will not be added to Task Tags in Eclipse.
   var i = 0
  </script>
 </body>
</html>

Would result in the following descriptions appearing in your Tasks view:

TODO: Add meta tags and page title here.
FIXME: There might be a semicolon missing in this code.

To enable Task Tags in Eclipse go to Preferences > General > Editors > Structured Text Editors > Task Tags.

(Eclipse Java EE IDE for Web Developers. Version: Indigo Service Release 1 Build id: 20110916-0149)

like image 81
duckah Avatar answered Oct 23 '22 16:10

duckah