One unexpected (for me) advantage of the current behavior is that I can sort of simulate autocomplete by typing "object.property" then Cmd-L, then Backspace, then ".property2", then Cmd-L, then Backspace, etc.

(In reply to Panos Astithas [:past] from comment #1)
> One unexpected (for me) advantage of the current behavior is that I can sort
> of simulate autocomplete by typing "object.property" then Cmd-L, then
> Backspace, then ".property2", then Cmd-L, then Backspace, etc.
The "code -> ctrl-l -> backspace" thing can still work if, in the selection, the "\n" is included.

(In reply to Paul Rouget [:paul] from comment #2)
> (In reply to Panos Astithas [:past] from comment #1)
> > One unexpected (for me) advantage of the current behavior is that I can sort
> > of simulate autocomplete by typing "object.property" then Cmd-L, then
> > Backspace, then ".property2", then Cmd-L, then Backspace, etc.
>
> The "code -> ctrl-l -> backspace" thing can still work if, in the selection,
> the "\n" is included.
Yes, that would be nice.

Created attachment 598803[details][diff][review]
Proposed fix.
Added a newline character in front of the comment block that is generated
by the writeAsComment function of the Scratchpad editor.
The preceding newline character is being selected aswell when a user presses cmd+L, so the method that past described above still works.

Comment on attachment 598803[details][diff][review]
Proposed fix.
Review of attachment 598803[details][diff][review]:
-----------------------------------------------------------------
Great patch!
Now this patch doesn't need a new test, but Scratchpad has tests that are now broken by the change in writeAsComment(). Please run the Scratchpad tests and fix the failing tests in browser/devtools/scratchpad/test/. I see:
Browser Chrome Test Summary
Passed: 221
Failed: 21
Looking forward for the updated patch!

Created attachment 599117[details][diff][review]
Proposed fix with fixed tests.
Thanks for the feedback! Fixed the two tests that were complaining due to the changes in writeAsComment() - Tests passed now: 242/242