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.

Bug 130405 - Implement comment block action
Summary: Implement comment block action
Status: RESOLVED FIXED
Alias: None
Product: web
Classification: Unclassified
Component: CSS Visual Tools (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: Marek Fukala
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-18 14:30 UTC by Marek Fukala
Modified: 2009-03-23 16:30 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marek Fukala 2008-03-18 14:30:01 UTC
try to toggle comment in a css file:

/* prefix is added to the selected lines, ending */ chars are missing.
Comment 1 Marek Fukala 2008-03-18 15:02:23 UTC
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.
Comment 2 Torbjorn Norbye 2008-03-18 16:10:47 UTC
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>
Comment 3 Marek Fukala 2008-03-18 16:33:42 UTC
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.

Comment 4 Torbjorn Norbye 2008-03-18 16:39:16 UTC
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.
Comment 5 Marek Fukala 2008-03-18 17:03:20 UTC
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.
Comment 6 Marek Fukala 2008-09-25 19:08:16 UTC
this is an enhancement.
Comment 7 Marek Fukala 2009-03-23 16:30:03 UTC
already implemented