Skip to content

EditOperation

A single edit operation to perform on a file. Supports multiple edit types: find/replace, line-range replacement, insert, and delete.

Kind: an object, used in requests.

FieldTypeRequiredDescription
typestringOperation type: “replace” (find/replace), “replaceLines”, “insertAfter”, “deleteLines”.
findstring | nullString to find (for a replace operation).
replacestring | nullString to replace with (for a replace operation).
replaceAllbooleanReplace all occurrences, not just first (for a replace operation). Default false.
startLineinteger | nullStart line number, 1-based (for a replaceLines operation).
endLineinteger | nullEnd line number, 1-based, inclusive (for a replaceLines operation).
contentstring | nullNew content to replace lines with (for a replaceLines or insertAfter operation).
insertAfterLineinteger | nullInsert new content after this line number, 1-based (for an insertAfter operation). Use 0 to insert at the beginning of the file.
deleteLinesinteger[] | nullLine numbers to delete, 1-based (for a deleteLines operation).
{
"type": "...",
"find": "...",
"replace": "...",
"replaceAll": false,
"startLine": 0,
"endLine": 0,
"content": "...",
"insertAfterLine": 0,
"deleteLines": [
0
]
}