The default bug view has changed. See this FAQ.

WebConsole autocompletion doesn't autocomplete on string literals.

RESOLVED FIXED in Firefox 17

Status

()

Firefox
Developer Tools: Console
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: espadrine, Assigned: espadrine)

Tracking

Trunk
Firefox 17
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 3 obsolete attachments)

(Assignee)

Description

5 years ago
The following content, typed in the WebConsole:

> "Dolske".<TAB>

… should autocomplete.

This is the last feature, not counting bug 774753,
that we need to get parity with WebKit's Developer Tools autocompletion.
(Assignee)

Comment 1

5 years ago
Created attachment 649513 [details] [diff] [review]
Autocompletion of string literals

This patch distinguishes string literals and objects, and autocompletes on both.
It uses the already-existing state machine.

It passes the mochitests.
Assignee: nobody → thaddee.tyl
Attachment #649513 - Flags: review?(mihai.sucan)
(Assignee)

Comment 2

5 years ago
Created attachment 649957 [details] [diff] [review]
Autocompletion of string literals

Dealt with matchProp, added a test.

This patch is meant to be dealt with after the non-object patch (bug 79415).
Attachment #649513 - Attachment is obsolete: true
Attachment #649513 - Flags: review?(mihai.sucan)
Attachment #649957 - Flags: review?(mihai.sucan)
(Assignee)

Comment 3

5 years ago
Created attachment 649964 [details] [diff] [review]
Autocompletion of string literals
Attachment #649957 - Attachment is obsolete: true
Attachment #649957 - Flags: review?(mihai.sucan)
Attachment #649964 - Flags: review?(mihai.sucan)
Comment on attachment 649964 [details] [diff] [review]
Autocompletion of string literals

Review of attachment 649964 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks for your patch. Minor comments below.

::: browser/devtools/webconsole/WebConsoleUtils.jsm
@@ +914,5 @@
>  
> +  let lastDot = completionPart.lastIndexOf(".");
> +  if (lastDot > 0 &&
> +      (completionPart[lastDot - 1] === "'" ||
> +       completionPart[lastDot - 1] === '"') &&

s/===/==/

(this is nit: please follow existing code style: no strict checks unless needed.)

@@ +915,5 @@
> +  let lastDot = completionPart.lastIndexOf(".");
> +  if (lastDot > 0 &&
> +      (completionPart[lastDot - 1] === "'" ||
> +       completionPart[lastDot - 1] === '"') &&
> +      (completionPart[0] === '"' || completionPart[0] === "'")) {

here you might want completionPart[0] == completionPart[lastDot - 1].

@@ +923,2 @@
>  
> +  } else {

nit: code style:
}
else {
Attachment #649964 - Flags: review?(mihai.sucan) → review+
(Assignee)

Comment 5

5 years ago
(In reply to Mihai Sucan [:msucan] from comment #4)
> @@ +915,5 @@
> > +  let lastDot = completionPart.lastIndexOf(".");
> > +  if (lastDot > 0 &&
> > +      (completionPart[lastDot - 1] === "'" ||
> > +       completionPart[lastDot - 1] === '"') &&
> > +      (completionPart[0] === '"' || completionPart[0] === "'")) {
> 
> here you might want completionPart[0] == completionPart[lastDot - 1].

I am worried to do this change, since I am looking forward
to introducing further literal completion capabilities,
and this would match regexp literal completion.
(Assignee)

Comment 6

5 years ago
Created attachment 651461 [details] [diff] [review]
[in-fx-team] Autocompletion of string literals

Nits.

Try push at: https://tbpl.mozilla.org/?tree=Try&rev=0dab4c567473
Attachment #649964 - Attachment is obsolete: true
Comment on attachment 651461 [details] [diff] [review]
[in-fx-team] Autocompletion of string literals

Landed:
https://hg.mozilla.org/integration/fx-team/rev/a8f42a338f37

Thank you Thaddee!
Attachment #651461 - Attachment description: Autocompletion of string literals → [in-fx-team] Autocompletion of string literals

Updated

5 years ago
Status: NEW → ASSIGNED
Whiteboard: [fixed-in-fx-team]
Version: unspecified → Trunk
https://hg.mozilla.org/mozilla-central/rev/a8f42a338f37
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 17
You need to log in before you can comment on or make changes to this bug.