Expand description
The editor’s file RPCs (read, write, list, reveal, create, delete; a rename is fs.rename), moved out of
register_editor_handlers unchanged as named functions. Each mutation takes the user’s home folder as a
parameter, so a test can point it at a temp dir; the registration passes dirs::home_dir().
Constants§
- MAX_
EDITOR_ 🔒FILE_ BYTES - readeditorfile and writeeditorfile refuse more than this.
Functions§
- check_
write_ 🔒size - Content past the limit is refused before anything else, remote or local.
- create_
dir 🔒 - Creates a directory inside an existing directory.
- create_
file 🔒 - Creates an empty file inside an existing directory.
- delete_
file 🔒 - Deletes a file or directory.
- dir_
entry 🔒 file_type()is the entry’s own type, so a symlink shows as one (no follow);metadata()follows symlinks, so a symlinked dir reportsis_dir. Both are needed:is_symlinkfrom the first,is_dirand size from the second (a symlink-to-dir reads as a directory, matching VS Code).- encode_
content 🔒 - The file’s original encoding, BOM and line endings, so a non-UTF-8 file round-trips instead of being silently rewritten as UTF-8. Absent fields default to UTF-8. The bool is true when some character has no representation in that encoding.
- is_
plain_ 🔒name - A new file or folder name is one plain path component.
- list_
dir 🔒 - Lists a directory for the editor’s file-tree pane. Symlinks are followed (matches VS Code semantics; the frontend marks followed symlinks with a ↗ overlay). Spec: docs/specs/SPEC_EDITOR_FILE_TREE_2026-05-26.md
- read_
local_ 🔒file - Reads the bytes and detects the encoding (BOM, then UTF-8, then a heuristic), decoding to UTF-8 for the editor, so non-UTF-8 files (Windows-1252 .ini, UTF-16, Shift_JIS, …) open instead of erroring.
- read_
remote_ 🔒file - A file on an SSH host: read there by its helper, decoded here the same way (remote terminals spec §6.3).
- read_
result 🔒 - The reply to a read: the detected encoding, BOM and line ending ride back so a save round-trips the original format. See docs/specs/SPEC_EDITOR_FILE_ENCODINGS_2026_06_17.md.
- reveal_
in_ 🔒shell - Reveals a path in the OS file manager.
- write_
local_ 🔒file - Writes restricted to under the user’s home directory: an allowlist, safer than an incomplete denylist.
- write_
remote_ 🔒file - A file on an SSH host: encoded here as for a local file, then written there atomically by its helper.