Eclipse:html文件中的javascript块中的任务标记

时间:2023-01-14 11:04:36

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.

是否可以为Eclipse中的html文件启用// TODO和// FIXME等任务标签?我已经检查过Eclipse的设置,并且没有HTML文件的“任务标签”部分。问题是我在html本身并没有真正使用这些任务标签;他们在html文件中的javascript块中。即使它们驻留在html文件中,以某种方式捕获它们也会很好。

1 个解决方案

#1


4  

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:

遗憾的是,Eclipse无法识别HTML中嵌入的JavaScript的任务标签。但是,您可以使用HTML注释在JavaScript块周围添加任务标记。例如:

<!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中启用任务标记,请转到首选项>常规>编辑器>结构化文本编辑器>任务标记。

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

(面向Web开发人员的Eclipse Java EE IDE。版本:Indigo Service Release 1 Build id:20110916-0149)

#1


4  

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:

遗憾的是,Eclipse无法识别HTML中嵌入的JavaScript的任务标签。但是,您可以使用HTML注释在JavaScript块周围添加任务标记。例如:

<!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中启用任务标记,请转到首选项>常规>编辑器>结构化文本编辑器>任务标记。

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

(面向Web开发人员的Eclipse Java EE IDE。版本:Indigo Service Release 1 Build id:20110916-0149)