Last Comment Bug 780791 - WebConsole autocompletion doesn't autocomplete on string literals.
: WebConsole autocompletion doesn't autocomplete on string literals.
Status: RESOLVED FIXED
:
Product: Firefox
Classification: Client Software
Component: Developer Tools: Console (show other bugs)
: Trunk
: All All
: -- normal (vote)
: Firefox 17
Assigned To: Thaddee Tyl [:espadrine]
:
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-06 18:19 PDT by Thaddee Tyl [:espadrine]
Modified: 2012-08-20 09:12 PDT (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Autocompletion of string literals (3.13 KB, patch)
2012-08-06 18:43 PDT, Thaddee Tyl [:espadrine]
no flags Details | Diff | Splinter Review
Autocompletion of string literals (3.28 KB, patch)
2012-08-07 21:47 PDT, Thaddee Tyl [:espadrine]
no flags Details | Diff | Splinter Review
Autocompletion of string literals (3.99 KB, patch)
2012-08-07 22:01 PDT, Thaddee Tyl [:espadrine]
mihai.sucan: review+
Details | Diff | Splinter Review
[in-fx-team] Autocompletion of string literals (4.01 KB, patch)
2012-08-13 10:43 PDT, Thaddee Tyl [:espadrine]
no flags Details | Diff | Splinter Review

Description Thaddee Tyl [:espadrine] 2012-08-06 18:19:34 PDT
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.
Comment 1 Thaddee Tyl [:espadrine] 2012-08-06 18:43:45 PDT
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.
Comment 2 Thaddee Tyl [:espadrine] 2012-08-07 21:47:08 PDT
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).
Comment 3 Thaddee Tyl [:espadrine] 2012-08-07 22:01:53 PDT
Created attachment 649964 [details] [diff] [review]
Autocompletion of string literals
Comment 4 Mihai Sucan [:msucan] 2012-08-13 09:15:07 PDT
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 {
Comment 5 Thaddee Tyl [:espadrine] 2012-08-13 10:36:22 PDT
(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 6 Thaddee Tyl [:espadrine] 2012-08-13 10:43:52 PDT
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
Comment 7 Mihai Sucan [:msucan] 2012-08-17 08:44:07 PDT
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!
Comment 8 Tim Taubert [:ttaubert] 2012-08-20 09:12:05 PDT
https://hg.mozilla.org/mozilla-central/rev/a8f42a338f37

Note You need to log in before you can comment on or make changes to this bug.