Repository navigation
feat(files): open text in editor and retain syntax tokens - #767
Merged
Merged
Conversation
nixuuu
force-pushed
the
fix/files-highlighting-editor
branch
from
November 15, 2026 00:20
c6e15e7 to
e2f809e
Compare
nixuuu
marked this pull request as ready for review
November 15, 2026 00:37
This was referenced Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Writable text files now open directly in the editor. Typing pins a preview tab; saving and discarding keep the editor, cursor and undo state mounted. Files without write permission, linked or offline computers, images, binary files and files above the edit limit stay read only. Dirty drafts remain visible when editing becomes unavailable.
Scrolling used to replace the reader token map and debounce editor decorations for each viewport. The tokenizer kept grammar checkpoints but discarded line tokens. Both web surfaces now consume persistent line tokens from one background executor, which prepares the file in bounded batches and invalidates the grammar suffix after edits. Token memory and execution time stay bounded; pathological long lines retain readable plain text. Mobile removes the same edit toggle and retains/prefetches highlight windows in its existing JS reader. Its native TextInput still uses plain text while typing and highlighted Preview changes.
Related: #640, #648
Validation: install, generated-contract check, full typecheck, lint, formatting check and web production build passed. The syntax regression tests passed (5 tests, 112 assertions), covering a 20k-line multiline grammar revisit, edits and JSON/YAML/Python. Browser review used an isolated synthetic stack: light/dark, desktop/390px phone, small/20k-line files, a 50k-character line, TypeScript/Python/JSON/YAML, permission/size/binary/image read-only cases, dirty availability loss, save/discard and close protection. No UI suites or full integration/check:tmp run. Native device behavior and generated Expo fingerprint hashes were not measured; native dependency/config/module inputs and lockfile are unchanged.
Scroll measurements (Chromium 157, 1280×800, Vite, 20,000 lines/308,889 bytes, 360 rAF frames forward/back, without recording):
Final editor maximum was 16.8 ms, with no intervals above 33.4 ms. These are rAF intervals, not compositor presentation timings. First coloring is asynchronous: an immediate cold reader sweep still sampled 2,073/12,652 plain lines during grammar startup. Returning to prepared lines does not repeat that transition. Recordings add substantial overhead and were excluded from frame-time conclusions. Evidence is kept outside the repository in
/var/tmp/canopy-file-viewer-shots/.Copy audit (§8): removed Edit/Stop editing; retained Save file/Discard changes and their existing confirmation behavior. Read only and offline/other-computer explanations describe the current state and the recovery action. Labels remain English, use existing terms and sentence case, and fit phone/desktop layouts in both themes. No internal tokenizer details were added to the user flow.