Closed Bug 1644158 Opened 4 years ago Closed 4 years ago

Devtools console autocompletion corrects perfectly reasonable code to nonsense

Categories

(DevTools :: Console, defect)

77 Branch
defect

Tracking

(firefox79 fixed)

RESOLVED FIXED
Firefox 79
Tracking Status
firefox79 --- fixed

People

(Reporter: marijnh, Assigned: nchevobbe)

Details

Attachments

(3 files)

What were you doing?

Please tell us what site you were on, and what steps led to the error you are reporting

  1. Open the devtools console
  2. Type x = {} and press enter
  3. Type foo(x) and press enter

What happened?

The closing parenthesis was replaced by x

What should have happened?

The input I type gets evaluated.

I wonder if you're hitting Bug 1624661.
Would you be able to check on Beta (78) if you can still reproduce this issue?

Flags: needinfo?(marijnh)

It exists in 78.0b4. Does it not occur for you?

Flags: needinfo?(marijnh)

Sadly no, I can't reproduce :/
Do you have the "autoclose brackets" setting turned on?

Could you attach a screencast so I can have a sense of the speed that's happening at and the order of operation?

We had a few weirdness with autocomplete (and fast typist), so we might still have issues.

Yes, autoclose brackets is on—and if I turn it off the problem goes away.

I've attached a screencast, but there's really nothing more going on than what I describe in the original issue. It'll complete over the closing paren when you press enter, though there's no completion dropdown visible anymore.

(Not sure what bugzilla's problem with the video is—when I download it mplayer plays it without trouble.)

okay, I think I'm able to reproduce, I'll investigate, thanks for the report and the information!

The console editor uses the codeMirror autoclose bracket addon,
which when the user types a closing bracket and the next char
in the input is the same char, won't insert a new char, but will
only move the cursor.
In such case, the JsTerm code wasn't capturing this key event, and
it could happen that the autocomplete would still be displayed,
which would then lead to some weirdness when the user hits Enter.
In order to fix that, we listen for the keyHandled event, which
is fired one a keypress was handled, and that appear that be fired
for the case I exposed, and isn't triggered when the character is
simply inserted.
A test case is added in one of our test to make sure this works as
expected.

Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f818841dc694 Close autocomplete when typing a closing bracket. r=bomsy.
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 79
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: