Note kit command

text.delete

Delete text

Deletes the text between `from` and `to` and answers the note's new length; pass `expected` (the text you mean to delete) so a stale position fails instead of deleting the wrong text.

Kit
Note 0.3.0 (Markdown (.md))
Changes the document
yes

Parameters

Parameters of text.delete
NameTypeRequiredDescription
expectedstringnoThe text there now; the command is refused when it differs.
fromintegeryesWhere the range starts.
tointegeryesWhere the range ends (exclusive).
unit"scalar" | "utf16"noHow positions are counted: Unicode characters (scalar, the default), or UTF-16 code units as the editor counts them.

Call through note_run

text
note_run {
  "path": "<file>.md",
  "steps": [{ "command": "text.delete", "params": { "from": <integer>, "to": <integer> } }]
}

The required parameters, with placeholders for their types: not a tested example. Optional: expected, unit. note_run answers the step’s result in completed[i].result.

Result

Result of text.delete
NameTypeRequiredDescription
lengthintegeryesThe note's length after the edit, in the request's unit.
Result JSON Schema
json
{
  "additionalProperties": false,
  "properties": {
    "length": {
      "description": "The note's length after the edit, in the request's unit.",
      "type": "integer"
    }
  },
  "required": [
    "length"
  ],
  "type": "object"
}

Parameter schema

json
{
  "additionalProperties": false,
  "properties": {
    "expected": {
      "description": "The text there now; the command is refused when it differs.",
      "type": "string"
    },
    "from": {
      "description": "Where the range starts.",
      "type": "integer"
    },
    "to": {
      "description": "Where the range ends (exclusive).",
      "type": "integer"
    },
    "unit": {
      "default": "scalar",
      "description": "How positions are counted: Unicode characters (scalar, the default), or UTF-16 code units as the editor counts them.",
      "enum": [
        "scalar",
        "utf16"
      ],
      "type": "string"
    }
  },
  "required": [
    "from",
    "to"
  ],
  "type": "object"
}

Generated from kition-sdk packages/script/kits/note.ts and the kit itself (kition-note@69e14d9). As data: commands.jsonl.