Closed Bug 2015287 Opened 10 months ago Closed 9 months ago

Add SourceEditor API to get the text content in the editor before the cursor

Categories

(DevTools :: Console, task, P3)

task

Tracking

(firefox149 fixed)

RESOLVED FIXED
149 Branch
Tracking Status
firefox149 --- fixed

People

(Reporter: bomsy, Assigned: bomsy)

References

(Blocks 1 open bug)

Details

Attachments

(1 external file)

Add SourceEditor API to get the text content in the editor before the cursor, this API should handle both CM5 and CM6 scenarios.

Currently JSTreminal has getInputValueBeforeCursor which for CM5 https://searchfox.org/firefox-main/rev/42ffcd4d00d7358cc074b6537f3c99960f4a9807/devtools/client/webconsole/components/Input/JSTerm.js#1384-1390

  getInputValueBeforeCursor() {
    return this.editor
      ? this.editor
          .getDoc()
          .getRange({ line: 0, ch: 0 }, this.editor.getCursor())
      : null;
  }

We can leverage and expand this to support CM6

Assignee: nobody → hmanilla
Status: NEW → ASSIGNED
Priority: -- → P3
Pushed by hmanilla@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/8765c15e32ed https://hg.mozilla.org/integration/autoland/rev/afcd094fa6bd [devtools] SourceEditor API to get the text before the cursor position r=devtools-reviewers,nchevobbe
Status: ASSIGNED → RESOLVED
Closed: 9 months ago
Resolution: --- → FIXED
Target Milestone: --- → 149 Branch
QA Whiteboard: [qa-triage-done-c150/b149]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: