[enhancement] improve code folding#6115
Merged
Merged
Conversation
Member
|
This appears to fix #3241. |
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.
Description
This PR adds code folding to YAML and PandocDiv nodes, and it preserves folded regions across editor focus changes
Changes
A
foldNodePropwas added to the markdown parser, which calculates fold regions for pandoc divs and yaml frontmatter.A
foldedRangesattribute was added toEditorViewPersistentState, which holds a decoration set of the currently folded ranges in the editor. When the document is loaded, the range set is iterated over, and a fold effect is dispatched for each range. This preserves the folded ranges across editor focus changes.The styling for the
foldPlaceholderwas moved to themain-overridesfile, and the background was made transparent. Previously, the background color was set to match the old editor background color, but that was updated in v4, and now the fold placeholder is out-of-sync. Making it transparent removes the need to keep it in sync. A border element was added to the dark mode placeholder, and this matches the light mode styling.Additional information
Tested on: macOS 26/Fedora 43