Expand description
§DocumentStateDTO
§RESPONSIBILITY
- Data transfer object for text document state
- Serializable format for gRPC/IPC transmission
- Used by Mountain to track document lifecycle and sync with Air
§FIELDS
- URI: Unique document resource identifier
- LanguageIdentifier: Language ID for syntax highlighting
- Version: Client-side version for change tracking
- Lines: Document content split into lines
- EOL: End-of-line sequence (\n or \r\n)
- IsDirty: Indicates unsaved changes
- Encoding: File encoding (e.g., utf8)
- VersionIdentifier: Internal version for host tracking
TODO (Mountain→Air Split): If Air implements a background document sync service, consider delegating delta change validation or conflict resolution to Air. For now, Mountain handles this synchronously to ensure UI responsiveness.
Structs§
- Document
StateDTO - Represents the complete in-memory state of a single text document.
Constants§
- MAX_
DOCUMENT_ 🔒LINES - Maximum line count for a document to prevent memory exhaustion
- MAX_
LANGUAGE_ 🔒ID_ LENGTH - Maximum language identifier string length
- MAX_
LINE_ 🔒LENGTH - Maximum line length to prevent line-based denial of service
Functions§
- Apply
Delta 🔒Changes - Applies delta changes to the document text and returns the updated lines.
- CMP_
Range_ 🔒Position - Compares two RPC ranges to determine their order in the document. Returns negative if a comes before b, zero if equal, positive if a comes after b.
- Position
ToOffset 🔒 - Converts line/column position to byte offset in text.