Closed Bug 746218 Opened 12 years ago Closed 11 years ago

Source Editor should comment a block with // comments

Categories

(DevTools :: Source Editor, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: dangoor, Unassigned)

References

(Depends on 1 open bug)

Details

(Whiteboard: [sourceeditor][fixed by work for bug 816756])

Attachments

(1 file)

Some combination of bug 725430 and bug 739192 added the ability to comment/uncomment a line or block of code in the source editor. When you comment a line of code, it adds a // at the beginning of the line. When you select a block of code, it uses /* */.

I just confirmed that both TextMate and Sublime Text use // at the beginning of lines in both cases. The reason can be seen in this test case:

var foo = function() {
    var bar = 27; /* This is my code */
}

foo();


If you comment a block of code that contains /* */ already, that code becomes invalid.
Kevin, do you suggest that we drop the use of block comments entirely and only add line comments, in all cases?
Yes, that is what I'm suggesting. It's what other editors do as well.
Thanks! Marking this as a tentative to be fixed with bug 759351.
Assignee: nobody → mihai.sucan
Status: NEW → ASSIGNED
Depends on: 759351
OS: Mac OS X → All
Hardware: x86 → All
Version: unspecified → Trunk
Moving to Source Editor component.

Filter on CHELICERAE.
Component: Developer Tools → Developer Tools: Source Editor
Attached patch proposed patchSplinter Review
Attachment #645434 - Flags: review?(rcampbell)
Depends on: 734831
No longer depends on: 759351
Blocks: 757071
Comment on attachment 645434 [details] [diff] [review]
proposed patch

+   *         - allowBlockComment: tells if the code that comments out
+   *         a selection is allowed to use the block comment wrappers. If not,
+   *         you should use the line comment string.

do we need this option at all? No point in complicating things if we're just going to stick with // line comments...

but then I remembered the CSS editor. Looks like it is needed after all.
Attachment #645434 - Flags: review?(rcampbell) → review+
to land?
Paul: all source editor patches wait for:

1. the orion upstream update. bug 759351
2. their owners to finish them up. In this case I do not need to make any patch changes. However I do need to address Rob's review comments for other patches I submitted for review.
3. currently I am prioritizing work on the web console remote debugging support - bug 768096. Source editor work needs to wait.

Thanks!
Whiteboard: [sourceeditor] → [sourceeditor][waiting-on-orion-update][see-comment-8]
Switch to CodeMirror fixed this.
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Assignee: mihai.sucan → nobody
Whiteboard: [sourceeditor][waiting-on-orion-update][see-comment-8] → [sourceeditor][fixed by work for bug 816756]
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: