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 111827 - Difficulties with commenting/uncommenting
Summary: Difficulties with commenting/uncommenting
Status: NEW
Alias: None
Product: obsolete
Classification: Unclassified
Component: languages (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@obsolete
URL:
Keywords:
Depends on:
Blocks: 110505
  Show dependency tree
 
Reported: 2007-08-02 21:02 UTC by Torbjorn Norbye
Modified: 2008-07-30 10:30 UTC (History)
0 users

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 Torbjorn Norbye 2007-08-02 21:02:48 UTC
I tried to add commenting tokens for RHTML files. I added the following to the RHTML.nbs file (in ruby/rhtml/src/**/).

COMMENT_LINE {
    prefix:"<%# ";
    suffix:" %>";
}

However, when I place the caret on a line with text and apply "comment", nothing happens.

If I place the caret on an empty line, it -does- insert <%# %>

Also, if I hit undo (Ctrl-Z) I have to press it twice - it first deletes the suffix, then the prefix. I think these text modifications should be done under an 
atomicLock to make sure that they can be undone as a single unit.
Comment 1 Jan Jancura 2007-08-03 11:19:17 UTC
We will look at it.
Comment 2 Daniel Prusa 2007-08-29 15:56:59 UTC
I have fixed the problem with undo.

Commenting RHTML non-empty lines does not work from the reason that there is an embedded token sequence of text/html
mime type in token sequence of application/x-httpd-eruby mime type. The commnet action is driven by nbs file given by
the most embedded mime type (which is text/html). Currently, we do not have any support to handle this situation.
Comment 3 Torbjorn Norbye 2007-08-29 16:02:21 UTC
It's unlikely that the prefix/suffix approach would work well for RHTML anyway (because the preferred behavior would be
to go -inside- existing <% %> delimiters and add/remove a "#" right inside the "<%").

Is there a way to provide a custom method to handle this? (I've noticed method hooks used in many other places for more
complicated behavior).

If not, would that be hard to provide? Then I can write the RHTML specific logic myself.
Comment 4 Daniel Prusa 2007-08-30 14:11:22 UTC
There is no support for handling by a custom method, but we can add it. However, there still be the problem with
invoking the action on a line with an embeded mime type different to application/x-httpd-eruby.
Comment 5 Torbjorn Norbye 2007-08-30 16:16:18 UTC
Yes, the embedded scenario is there but I'm already handling it for indentation so I think I could do something similar
for comments (unless I don't understand what the problem is).  

But if you could add a hook mechanism that would be great!