Closed Bug 1493675 Opened Last year Closed Last year

Autocomplete popup is annoying when typing `function`

Categories

(DevTools :: Console, defect, P1)

defect

Tracking

(firefox64 fixed)

RESOLVED FIXED
Firefox 64
Tracking Status
firefox64 --- fixed

People

(Reporter: nchevobbe, Assigned: nchevobbe)

References

Details

(Whiteboard: [boogaloo-mvp])

Attachments

(2 files)

**Steps to reproduce**
1. Open the console
2. Type `func`
3. The autocomplete popup is displayed with `Function` (note the uppercase F).
4. Hit enter

**Actual results**

My input is now `Function`, which might be fine, but actually, I wanted to declare a new function, so I have to go back to the first letter and replace it with a lowercase f.

---

There's 2 way of fixing this:
 - quick and ugly: filter out "Function" from result when the input is all lowercase
 - nicer: return all the keywords from the autocomplete. Since lowercase items are displayed first, `function` will come before `Function` and the STR will work as I intended.

I'm leaning towards the second solution as it would be a really nice thing to have. But we may not have enough time to put this into 64, and if so, it would be nice to have a quick fix for that.
Whiteboard: [boogaloo-reserve]
So, it looks like there's no existing API to retrieve the list of JS keywords.
The list lives in https://searchfox.org/mozilla-central/source/js/src/frontend/ReservedWords.h, and is then processed with a python script [1] (see usage [2]) to generate the file being used by the engine [3]

We could use a similar approach to generate a JS file with all the keywords, which we could then easily use in DevTools code.


[1] https://searchfox.org/mozilla-central/source/js/src/frontend/GenerateReservedWords.py
[2] https://searchfox.org/mozilla-central/rev/881a3c5664ede5e08ee986d76433bc5c4b5680e6/js/src/moz.build#692-697
[3] https://searchfox.org/mozilla-central/source/__GENERATED__/js/src/frontend/ReservedWordsGenerated.h
Duplicate of this bug: 1494743
Priority: -- → P2
Blocks: 1499005
Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Priority: P2 → P1
This patch adds a file containing an arrau of all the
JS keywords, extracted from js/src/frontend/ReservedWords.h.
The webconsole autocomplete service then load this array, and
send the matching keywords to the client.
Later, this file will be automatically generated at build time (
See Bug 1499005) in order to be kept in sinc with what the engine
defines.
Whiteboard: [boogaloo-reserve] → [boogaloo-mvp]
This list is generated from /js/src/frontend/ReservedWords.h,
which is already used on the platform to generate list of js
reserved words.
This list will be used in the console autocomplete code to
expose those keywords to the user.
Attachment #9017917 - Attachment description: Bug 1493675 - Generate an array of the javascript keywords; r=ochameau. → Bug 1493675 - Generate an array of the javascript keywords; r=arai.
Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/887b52d6d707
Generate an array of the javascript keywords; r=arai.
https://hg.mozilla.org/integration/autoland/rev/cc4cf7804458
Send JS keywords from webconsole's autocomplete service; r=julienw.
https://hg.mozilla.org/mozilla-central/rev/887b52d6d707
https://hg.mozilla.org/mozilla-central/rev/cc4cf7804458
Status: ASSIGNED → RESOLVED
Closed: Last year
Resolution: --- → FIXED
Target Milestone: --- → Firefox 64
You need to log in before you can comment on or make changes to this bug.