Repository navigation
fix(editor): a flow insert copies only a separator a member wrote - #28
Merged
adammharris merged 1 commit intoNov 6, 2026
Conversation
An insert into a non-empty flow mapping, for a format that sets
flow_kv_sep_from_siblings, took its key-value separator from the first
member and its joint from the gap after it. A rule nested in a fig-css
block has neither: `&:hover { b: c }` has a space before its value and
needs nothing after its `}`. So a declaration added to a block opening
with one was spelled without a separator, and refused as NotFound or
UnsupportedOperation.
A member whose bytes between key and value are only space now has no
separator to copy. The insert copies from the first member that has one,
and takes the joint from the gap after that member. With none, it writes
what an empty mapping would, and the default joint. figl requires `=` or
`:` in a flow object, so its inserts do not change; its edit fixtures now
hold that for a nested object.
Closes docs/tasks/a-flow-insert-copies-a-separator-from-a-nested-rule.md.
Behavioural-change: inserting into a flow mapping whose first member has only space between its key and value, in a language that sets flow_kv_sep_from_siblings, now writes a valid entry. It used to be refused with NotFound or UnsupportedOperation. fig-css's `.a { &:hover { b: c } }` takes `x` as `.a { &:hover { b: c }; x: y }`.
adammharris
deleted the
agent/backlog-a-flow-insert-copies-a-separator-from-a-nested-rule
branch
November 6, 2026 22:59
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.
What changed
insert_flow_map_entryandflow_map_jointinrust/fig-core/src/editor/mod.rs, for a language that setsflow_kv_sep_from_siblings:written_kv_sep).flow_map_kv_sep, or elsekv_sep) and the default joint.Why
A rule nested in a fig-css block is a selector over a flow mapping, so
&:hover { b: c }has no separator after its selector and needs nothing after its}. The editor copied those bytes, wrote an entry that was not a declaration, and refused the edit withNotFoundorUnsupportedOperation.The task suggested comparing a sibling's bytes with
kv_sep. This tests for non-space bytes instead, because figl's:-mode writes:, which is not itskv_sep. figl requires=or:in a flow object, so every figl member passes and its inserts take the same path as before.Closes
docs/tasks/a-flow-insert-copies-a-separator-from-a-nested-rule.md. fig-css itself takes the change at fig's next release.How it was verified
ship ci: all 11 jobs passed. TheTypeScriptjob skipped its tests locally becausenode_modulesis missing, so that suite is left to this PR's CI.bindings/rust/fig/tests/sibling_separators.rsis new and registers a small nested-rule language. Three of its four tests failed before the fix, with the task'sNotFoundandUnsupportedOperation, and all four pass now. The fourth is the control.languages/figl/tests/edits.jsongains a case for a nested object in=mode, comma-joined and JSON-embedded. figl is 155/155 with the fix. The case was not run against the unfixed editor.[patch.crates-io]: each failingsetin the task returnsOk,with_declaration("&:hover{b:c}", "a", Some("blue"))returns&:hover{b:c}; a: blue, itsdeclarationforaisblue, and its 13 tests pass.