Introduce WebIDE as an extension for Editor Lite
What does this MR do?
This MR wraps our custom Monaco implementation for WebIDE into an Editor Lite extension in the course of using Editor Lite as the driving engine for WebIDE.
Important things to note about what's going on here:
Originally app/assets/javascripts/editor/extensions/editor_lite_webide_ext.js
has been kept as close to the original app/assets/javascripts/ide/lib/editor.js
as possible but at some point it stopped making any sense because there were too many unnecessary things going on in the original implementation. Hence I went on and refactored the editor in this extension. Among the most important things to note here:
- We create a new instance only when opening any text file for the first time, or on the view change. Previously we discarded and re-created instance for every new file that was a waste of resources. Instead, we create/dispose of models and attach them to the already-existing instance
- Removed unnecessary things that overcomplicated the implementation and seemed to be the artifacts of the many previous generations onf the implementation:
- Removed
DirtyDiffController
from the extension - Removed
DecorationsController
- Removed un-used-anymore currentModel
- Moved the
ModelManager
out of the extension. This is done because we have to have the global manager for the models to avoid duplicating models in Monaco. Having this manager in the extension would re-instantiate it every time we re-create an instance (since extensions are applied on a per-instance basis) and would attempt to create a model that might already exist in Monaco. The correct solution here would, of course, be to updateModelManager
, but this should be done in a separate MR after we field-test the extension and the functionality.
- Removed
-
⚠ the changes inspec/frontend/ide/components/repo_editor_spec.js
are related to re-writing the whole spec to proper@vue/test-utils
basis and the cleanup related to the updated functionality of therepo_editor
. So the structure and the tests in it are pretty much the same as before, but are executed with the "newer" tools and optimized where due.
Screenshots (strongly suggested)
Scenario | Video |
---|---|
The simple workflow | simple-workflow |
Editing multiple files | multiple-files |
Switching between Edit and Review tabs (the fix of a bug reported in PoC) | edit-to-review |
Switching between code and binary files (the fix of a bug reported in PoC) | code-to-binary |
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
References #297449 (closed)
Edited by Denys Mishunov