Repository navigation
Conversation
Author
|
Moved this proposal to our fork: mitos-editor#1. |
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.
A small edit can rerun an injection query across a large syntax tree even when the source cannot contain a match. In the editor's JSON workload, looking for comment injections dominates otherwise incremental whitespace edits.
Add an optional
injection.source-patternproperty. It is a necessary condition supplied by the query author: if every injection pattern has a guard and none of those regexes matches the source, skip the injection query traversal. The regex reads the rope directly. Patterns without a guard retain the existing behavior, and existing injections are still mapped and pruned when the last marker is removed.For example, JSON's comment injection can use
(#set! injection.source-pattern "/[/*]"). Text without either comment opener cannot contain a comment injection. A marker inside a string is a safe false positive and falls back to the normal query. An incorrect guard can suppress real injections, so the README documents that contract; no existing query behavior changes unless it opts in.Both sides use the same patched dependency binary; only the JSON injection query property changes. The comparison uses the Mitos release-mode JSON probe: insert one space in the middle of a comment-free array and apply its inverse, taking the median of 11 pairs. It measures the full synchronous syntax update pair, not typing-to-screen latency. The editor change is mitos-editor/mitos#574 and adds the JSON query property. Its ignored
json_update_performancetest contains the probe. Documents containing a possible marker still execute the existing injection query.Validation: all 45 upstream tests passed, formatting passed, and focused Clippy passed with warnings denied. Tests cover comment insertion/removal, a mixed guarded/unguarded query, invalid regexes, a marker crossing rope chunks, and a marker inside a string.
cargo test --locked -p tree-house cargo fmt --all --check cargo clippy --locked --no-deps -p tree-house --all-targets -- -D warnings