Thursday May 22, 2008
Comment/Uncomment Lines in HTML/JSP/XML Files
I demoed a small plugin I was working on yesterday to Ludo—it lets you toggle the comment/uncomment tags in HTML, JSP and XML files, which is possible by default in Java source files (and in Properties files) but not in HTML files, JSP files, and XML files. At the time, the plugin only worked for single lines and only via a shortcut or a contextual menu item. However, Ludo told me that he uses the editor's toolbar and that he'd also like multiline selections to be possible. Well, Ludo, both items have been added and now the plugin is available in the Plugin Portal:
http://plugins.netbeans.org/PluginPortal/faces/PluginDetailPage.jsp?pluginid=9609
Make sure you read the open issues below the screenshots there, so that you're aware of them before you run into them by accident. In short, you're able to select multiple lines, as below, but if you don't, the plugin assumes that you're only interested in the current line, even if you haven't selected anything in the current line. Then you invoke the action, via Ctrl-Shift-C (just like in the Java editor and the Properties editor), or choose the contextual menu item, shown below, or Ludo's button in the editor's toolbar.
And then you find yourself with the comment tags around the selection (as illustrated below) which, when you select the selection again and then invoke the action again, are removed so that the selection is returned to its original state.
Note that the plugin installs this functionality for HTML files, XML files, and JSP files. I have tried it out on Ubuntu and a colleague tried it out on Windows XP. It worked as expected in both environments. Comments/uncomments on this plugin are more than welcome...
May 22 2008, 06:37:30 AM PDT Permalink


