Closed Bug 780791 Opened 12 years ago Closed 12 years ago

WebConsole autocompletion doesn't autocomplete on string literals.

Categories

(DevTools :: Console, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 17

People

(Reporter: espadrine, Assigned: espadrine)

Details

Attachments

(1 file, 3 obsolete files)

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.
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)
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)
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+
(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.
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
Status: NEW → ASSIGNED
Whiteboard: [fixed-in-fx-team]
Version: unspecified → Trunk
https://hg.mozilla.org/mozilla-central/rev/a8f42a338f37
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 17
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: