microsoft / microsoft/monaco-editor
API for collapsing ranges
@aeschli is already working on this.
Since Dec 14, 2023.
- Dominant language
- JavaScript
- Stars
- 46.8k
- Forks
- 4.1k
- Avg merge
- 17h 58m
- Merged PRs (30d)
- 1
Description
Context
- This issue is not a bug report. (please use a different template for reporting a bug)
- This issue is not a duplicate of an existing issue. (please use the search to find existing issues)
Description
Hi,
In our project the monaco editor displays a JSON, the content of which is sometimes refreshed from somewhere else. When this happens, I would like to restore the previous folding state. I have been doing this by reading out and later re-applying these collapsedRegions:
const viewState = editor.saveViewState();
viewState.contributionsState['editor.contrib.folding'].collapsedRegions
However, sometimes when I update my node packages, this functionality simply stops working even though the monaco-editor and @monaco-editor/react versions are unchanged (I can elaborate on that if you like).
I understand, since this is not public API things can break unexpectedly.
Is there perhaps a different way to programmatically read out collapsed ranges and to apply code folding?
Monaco Editor Playground Link
No response
Monaco Editor Playground Code
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.