Add ability to toggle standalone editor into a diff editor
See original GitHub issueIt would be great we if can just switch from IStandaloneCodeEditor
to IStandaloneDiffEditor
by providing an extra model that points to the original
.
We use Monaco in our app and highlight the diffs as line decorators. When the user clicks the decorator we want to toggle a side editor that shows the diffs inside IStandaloneDiffEditor
. I believe that this is not possible since IStandaloneDiffEditor
works in standalone mode.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
git - How do I edit the current revision of a file from diff view ...
As you noticed, the diff is sometimes editable from the Git Changes page in Team Explorer. Here's a summary of how we determine...
Read more >Visual Studio Code Tips and Tricks
Use the Toggle Output command (Ctrl+K Ctrl+H) and select Git in the dropdown. Gutter indicators. View diff decorations in editor. See documentation for...
Read more >Line-staging (Interactive Staging) - Visual Studio Blog
Ability to stage chunks of code directly from the editor; Addressed a number of issues and limitations. Work is in progress to add...
Read more >13 Best Text Editors to Speed up Your Workflow - Kinsta
Sublime Text provides split editing for managing and editing files next to each other. You can also open multiple windows and place them...
Read more >GitLab Web Editor
You can now make changes to any files, as needed. When you're ready to merge the changes back to your default branch, you...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I see two options to get that feature:
copy-paste the code from VS Code and adjust it.
implement from scratch by:
top
andheight
).Since this is not an issue with the Monaco Editor itself, I will close for now. Good luck!
The
IStandaloneCodeEditor
performs expensive DOM operations since it creates an actual editor, destroying the DOM elements and creating another editor based onIStandaloneCodeEditor
is not a cheap operation. It’s probably not a common use-case so let me explain our use-case:We have a web-based editor based on Monaco and I added line decorations that indicate the local changes as follows:
When the user clicks the line decorator, I basically destroy the
IStandaloneCodeEditor
and create anIStandaloneDiffEditor
and highlight the change over there. When the user switches to the edit mode, I destroy the Diff Editor and use theIStandaloneCodeEditor
.It’s probably no optimum way because the UX feels sluggish since I need to compute the diff again and add the line decorators, editor actions in each switch in addition to these expensive DOM operations.
VSCode has this feature out of the box with GIT extension but I couldn’t find a way to make it work in Monaco. One other alternative is to enable the edit mode in DiffEditor but it’s not really designed for edit mode as it adds overlay widgets and shows the 2 editors at the same time.
Is there any other way to implement the line decorators in Monaco similar to VSCode’s line decorators as seen in the following screenshot?