-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API for collapsing ranges #4024
Comments
FYI, I figured out that monaco-editor/loader version 1.3.3 breaks this feature. Everything still works fine with 1.3.2. I was able to pin this dependency in my project for now. |
I'd like to vote for this too. Programatically collapsing ranges of code is an absolutely essential feature. We are developing a code editor where I'd like to collapse large areas of boilerplate code which I can detect easily. But I can see no way of asking the editor to collapse them. VS Code has the command "Create folding range from selection". I want to be able to do this programatically having created a Selection |
We have several commands for folding that also can be used programmatically: e.g editor.fold |
How would we even know it exists? The documentation is TERRIBLE https://microsoft.github.io/monaco-editor/docs.html is just hostile. And anyway. Pointing to a typescript source file. How does that help ANYBODY? |
Yes, sorry, on further investigation I learned that the monaco API is slightly different than the VS Code API (that I'm familiar with). It doesn't seem to have an API to run a platform command (
|
Thx for looking into it. I will try it out and report back! |
This works, is there also a way to retrieve the currently collapsed regions? |
microsoft/vscode#201315 fixes the issue that action arguments are not passed to the command. |
No, currently not. |
Context
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
: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
The text was updated successfully, but these errors were encountered: