Repository navigation
fix(editor): preserve indent after compound closers - #328
Merged
Merged
Conversation
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.
Opening a line after compound closing delimiters could over-dedent it. In Rust, for example, pressing
oafter}),moved the new line and cursor to the enclosing block instead of keeping them aligned with the sibling field. The same shared indentation logic affected JavaScript, JSON, Lua, and other delimiter-based language packs.This change treats adjacent leading closers as one visual indentation group when their matching openers originated on the same source line. Closers for openers on earlier lines remain separate, preserving genuine structural dedents. It also adds editor-level coverage for
o,O, and Enter, plus portable Rust, JavaScript, JSON, and Lua fixtures.How to Test
Open a Rust buffer containing:
Place the cursor on
}),and presso. The new line and cursor should remain aligned withstate, not the enclosinglet.Run
cargo test --lib syntax_indent::tests::. All provider tests should pass, including the grouped-closer and cross-language fixtures.Run
cargo test --test editing rust_syntax_indentation_. All six focused editor tests should pass, coveringo,O, Enter, undo, typed closers, and the distinct-opener-line dedent regression.