The default bug view has changed. See this FAQ.

Add multiline editor mode to console

NEW
Unassigned

Status

()

Firefox
Developer Tools: Console
--
enhancement
2 years ago
16 days ago

People

(Reporter: canuckistani, Unassigned)

Tracking

(Depends on: 1 bug, Blocks: 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [devtools-ux])

Firebug has a multiline editor and our lack of one directly integrated into the console is a common complaint from Firebug users about the tools.

Comment 1

2 years ago
You can already use Ctrl+enter to write a new line, but I agree it's not convenient
Note that there was a request[1] a long time ago to make the Command Editor (multiline editor) independent from the Command Line.
So I suggest to rather allow docking Scratchpad and do so by default. I.e. mark this as duplicate of bug 708213.

Sebastian

[1] https://code.google.com/p/fbug/issues/detail?id=988
Severity: normal → enhancement
OS: Mac OS X → All
Hardware: x86 → All
See Also: → bug 708213
Version: 36 Branch → unspecified
I suggest we integrate the sourceeditor component for the multiline mode.  You could toggle the mode by pressing a new button to the right of the input line and it would copy the current contents of the input into a new editor.  This will get us syntax highlighting and other CodeMirror goodies.  If you press the button again it will copy the current contents of the sourceeditor back into the normal input field.
For comment 3 to work, we would need a new autocomplete mode for the source editor that takes the current global state into account - that might be quite some work
WebKit nightlies have a nice feature where it automatically enters into multiline mode if the input is not valid JS.  So if you type

foo.<ENTER>

it will go into a multiline mode

foo.
<CURSOR>

Note that you still need to shift+enter if you want to add new lines with 'valid' JS, otherwise it will execute what you have.
To have this Firebug-style button to toggle multiline mode, we would need additional UI to have a 'run' button when in that mode since pressing enter wouldn't automatically run the script anymore.
(In reply to Brian Grinstead [:bgrins] from comment #5)
> WebKit nightlies have a nice feature where it automatically enters into
> multiline mode if the input is not valid JS.  So if you type
> 
> foo.<ENTER>
> 
> it will go into a multiline mode
> 
> foo.
> <CURSOR>
> 
> Note that you still need to shift+enter if you want to add new lines with
> 'valid' JS, otherwise it will execute what you have.

Interesting, this seems like a nice way to do it.
(In reply to Sebastian Zartner [:sebo] from comment #2)
> Note that there was a request[1] a long time ago to make the Command Editor
> (multiline editor) independent from the Command Line.
> So I suggest to rather allow docking Scratchpad and do so by default. I.e.
> mark this as duplicate of bug 708213.
> 
> Sebastian
> 
> [1] https://code.google.com/p/fbug/issues/detail?id=988

FWIW this request is now hosted at https://github.com/firebug/firebug/issues/1128.

I still see a valid use case for having the command line and the multiline editor work mostly independent, i.e. allow to open them both at the same time. There may still be functionality, though, to copy the entered code between them.

Sebastian
Summary: Add mutliline editor mode to console → Add multiline editor mode to console
Whiteboard: [devtools-ux]
For a 'commit' keyboard shortcut if you get in a 'multiline' mode, we could use cmd/ctrl+enter, which is what we use for the HTML editing feature in the markup view
(In reply to Brian Grinstead [:bgrins] from comment #9)
> For a 'commit' keyboard shortcut if you get in a 'multiline' mode, we could
> use cmd/ctrl+enter, which is what we use for the HTML editing feature in the
> markup view

That's definitely the convention for the 'inline mutliline' concept - scratchpad instead has accel+r mapped to run the current buffer or selection, something I've found productive when I've used it.
(In reply to Brian Grinstead [:bgrins] from comment #5)
> WebKit nightlies have a nice feature where it automatically enters into
> multiline mode if the input is not valid JS.  So if you type
> 
> foo.<ENTER>
> 
> it will go into a multiline mode
> 
> foo.
> <CURSOR>
> 
> Note that you still need to shift+enter if you want to add new lines with
> 'valid' JS, otherwise it will execute what you have.

I like this idea. I'm also not entirely opposed to having a UI of some sort for this (a button, say). I think that part of the issue is that our current filtering system takes up a lot of space an is atypical; if we moved toward something that was less-so, adding a button to turn on multi-line editing wouldn't be a big deal.
See Also: → bug 1243851
Depends on: 1243851
See Also: bug 1243851
Depends on: 983473
(In reply to Helen V. Holmes (:helenvholmes) (:✨) from comment #11)
> (In reply to Brian Grinstead [:bgrins] from comment #5)
> 
> I like this idea. I'm also not entirely opposed to having a UI of some sort
> for this (a button, say). I think that part of the issue is that our current
> filtering system takes up a lot of space an is atypical; if we moved toward
> something that was less-so, adding a button to turn on multi-line editing
> wouldn't be a big deal.

The UI for the filters has changed in the meantime and does use less real estate now.
You need to log in before you can comment on or make changes to this bug.