Closed Bug 2015281 Opened 9 months ago Closed 9 months ago

Migrate getExpressionVariables to CM6

Categories

(DevTools :: Console, task, P3)

task

Tracking

(firefox150 fixed)

RESOLVED FIXED
150 Branch
Tracking Status
firefox150 --- fixed

People

(Reporter: bomsy, Assigned: bomsy)

References

(Blocks 1 open bug)

Details

Attachments

(1 external file)

getExpressionVariables gets all the variables declared in an expression, this is used to populate the autocomplete when typing out expressions in the JSTerminal.
https://searchfox.org/firefox-main/rev/42ffcd4d00d7358cc074b6537f3c99960f4a9807/devtools/client/webconsole/components/Input/JSTerm.js#932-949


  /**
   * Retrieve variable declared in the expression from the CodeMirror state, in order
   * to display them in the autocomplete popup.
   */
  _getExpressionVariables() {
    const cm = this.editor.codeMirror;
    const { state } = cm.getTokenAt(cm.getCursor());
    const variables = [];

    if (state.context) {
      for (let c = state.context; c; c = c.prev) {
        for (let v = c.vars; v; v = v.next) {
          if (v.name) {
            variables.push(v.name);
          }
        }
      }
    }

Lets extend this to API to support CM6

Priority: -- → P3
Assignee: nobody → hmanilla
Attachment #9543340 - Attachment description: WIP: Bug 2015281 - [devtools] SourceEditor API to get expression variables → Bug 2015281 - [devtools] SourceEditor API to get expression variables r=#devtools
Status: NEW → ASSIGNED
Pushed by hmanilla@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/5e7e190f8165 https://hg.mozilla.org/integration/autoland/rev/62f7b5eafa0f [devtools] SourceEditor API to get expression variables r=devtools-reviewers,nchevobbe
Status: ASSIGNED → RESOLVED
Closed: 9 months ago
Resolution: --- → FIXED
Target Milestone: --- → 150 Branch
Regressions: 2021290
QA Whiteboard: [qa-triage-done-c151/b150]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: