Skip to main content
How Mouse Works

Edit Operations Reference

INSERT, REPLACE, DELETE, REPLACE_RANGE, FOR_LINES, and ADJUST

Operation Types

Mouse supports six operation types:

INSERT

Add new content at a specific line:

{
  "operation": "insert",
  "afterLine": 10,
  "content": "// New comment"
}

REPLACE

Find and replace text:

{
  "operation": "replace",
  "find": "oldValue",
  "replace": "newValue",
  "replaceAll": true
}

DELETE

Remove lines:

{
  "operation": "delete",
  "region": [10, 15]
}

REPLACE_RANGE

Character-level precision:

{
  "operation": "replace_range",
  "region": [
    [10, 5],
    [10, 20]
  ],
  "content": "newText"
}

FOR_LINES

Apply same change to multiple lines:

{
  "operation": "for_lines",
  "lineRange": [10, 50],
  "colRange": [0, 0],
  "content": "// "
}

ADJUST

Move content without modification:

{
  "operation": "adjust",
  "rect": [[10, 29], 13, 41],
  "move": [0, 82]
}