This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
try to toggle comment in a css file: /* prefix is added to the selected lines, ending */ chars are missing.
The default current editor support (and GSF as well) doesn't count with the situation that there is a language which doesn't have line comments. There is a definition of a comment prefix - for example '//' for java, but for css, html and other langs. There is only a block comment like /* ... */ so extension of the framework is necessary if we do not want to implement the same logic per each language. For now, I just disabled the toggle comment for css so it does nothing.
I handled this for RHTML by registering a custom ToggleComment action. This operates at the top level language - which I actually think is the right behavior anyway. In other words, commenting out a line of JavaScript in a <script> block in an RHTML file will comment the line out like this: <script> <%# commented_out_line_of_JavaScript(); %> </script> instead of just <script> // commented_out_line_of_JavaScript(); </script>
Yes, of course, this is a backup solution for me, but: 1. the default implementation should be embedded aware so if just one language is selected, or if the start and end are in the same language the language's comment should be used. 2. there could be a generic support for making the block comment - if it is done line by line, e.g.: <!-- <html> --> <!-- text --> <!-- </html> --> then the un/toggle can be implemented in a generic way easily IMHO. As for the RHTML comment of javascript ... I would expect the JS comment :-) but it is just my opinion.
I raised this issue on the Ruby alias a while ago when I first implemented toggle comment for RHTML. The reason people prefer to use the top-level commenting provision is that when you comment out code you are trying to disable it. If you comment code out using the JavaScript mechanism, the comment will still show up in the rendered page that is downloaded to the user. If you comment it out using the Ruby ERB comment (<%# %>) the lines are removed on the server.
You are right, the javascript comment will disable the javascript code, but the code will be in the generated page. The question is what the user wants... If there were requests for doing it this way, I have no problem with that.
this is an enhancement.
already implemented