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.
Pull request type
Please check the type of change your PR introduces:
What is the current behavior?
DevToys 2.0 doesn't have a multi-line text input yet.
What is the new behavior?
Added a multi-line text input control that supports read-only and read-write mode.
Compared to DevToys 1.0, this time, every multi-line text input will use the Monaco Editor. This will help DevToys handling scenario where users paste very long text where we weren't necessarily expecting it.
DevToys 1.0 has a memory consumption issue related to Monaco: every time the monaco editor is needed, we create and allocate a new one. That means that when jumping from a tool that use Monaco to another that also use Monaco, we will now have 2 instances of Monaco (with 2 WebView) in memory. Each instances of Monaco consumes roughly 150 MB of RAM. This makes DevToys quickly consuming GB(s) of RAM.
In addition, loading the Monaco Editor is slow. It requires us to display a Progress Ring every time we open a tool for the first time that needs the editor.
In DevToys 2.0, we now use a pool of Monaco instances. Every time we jump from a tool to another, we will "release" the Monaco Editor that was in use in the tool, detach it from the UI. When navigating to the other tool, we will ask the pool to provide us an instance of Monaco. The pool will either provide an instance that got previously released, or produce a new one.
This way, when 2 tools need 1 Monaco editor, we allocate only one.
When navigating to the new tool, we change the text, language, settings of that Monaco instance we reused, so it adapts to the new tool. There might be a short time where we see the Monaco editor with a stale state, but in my opinion this constraint worth the gain of memory usage and loading speed of the tool.
This PR also address the following issues: #755, #494
Other information
Recording.2023-03-31.181010.mp4
Quality check
Before creating this PR: