Skip to content
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

Upgrade Monaco dependency to 1.83.1 #13217

Merged
merged 14 commits into from
Feb 15, 2024

Conversation

tsmaeder
Copy link
Contributor

@tsmaeder tsmaeder commented Dec 28, 2023

What it does

Upgrades our Monaco dependency to 1.83.1

Fixes #12679

Various changes were necessary, in particular:

  1. There is a new Implementation of the diff editor
  2. The setContext command has been renamed to '_setContext`.
  3. The typing for the URI class has changed and we need to do some casting: Inconsistencies between vscode-uri and uri typings microsoft/vscode#190584
  4. Our overriding of VS Code services in StandaloneServices has not been working for a while, but VS Code instantiating services eagerly instead of lazily has revealed the problem
  5. VS Code adds many icons to the registry in parts of VS Code that are not used in Theia. Instead of hacking the Theme icon id field, we now just register those icons
  6. Instead of adding our own styling for contributed icons, we now properly use the VS Code icon registry.

How to test

A lot of parts of Theia may be affected by this change and need testing, in particular:

  1. The monaco editor
  2. quick input
  3. debugger
  4. Built-in icons and themes

I'm opening this PR now in order to facilitate code review, but we still need

Follow-ups

  • support editor.indentSize: vscode support of editor.indentSize #13105
  • stubbed VS Code API:
    • provideDocumentRangesFormattingEdits
    • registerMultiDocumentHighlightProvider
  • check implementation notes in languages-main.ts
  • IQuickinputOptions.linkOpenerDelegate: unimplementd feature

Review checklist

Reminder for reviewers

@tsmaeder
Copy link
Contributor Author

Note that the failure in test are due to the way nodejs handle ES6 modules: here's what I fount out:

  1. The @theia/monaco-editor-core module is loaded as a CJS module due to the fact that the package.json does not contain a type: module line

  2. With this uplift, we do, for the first time have actual ES6 syntax in the monaco files:

@theia/preferences: export var Lexer = (__marked_exports.Lexer || exports.Lexer);
@theia/preferences: ^^^^^^
@theia/preferences: SyntaxError: Unexpected token 'export'
@theia/preferences:     at compileFunction (<anonymous>)

This is the only place actual import or export statements are used.

  1. When I tried to convert the monaco package to a real module, I got
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: <....monaco module>

This is because typescript compiles import to use "require". So we can't really mix & match ESM and CJS modules, it seems.

@tsmaeder
Copy link
Contributor Author

Maybe we can hack the module in question to remove the exports, but what about the next time some ES6-syntax appears in VS Code?

@tsmaeder tsmaeder marked this pull request as ready for review January 12, 2024 10:43
Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks generally fine, but I have a few remarks.

Most importantly, the performance of the editor initialization/syntax highlighting seemed to have noticably suffered:

Current master:

2024-02-01.13-37-15.mp4

Changes:

2024-02-01.13-37-03.mp4

Can you reproduce the performance regression? I've had a feeling for quite a while now that our monaco editors are way slower to initialize than vscode - something that was actually been reinforced by the bad performance of the notebook editors. However, with the new changes it's pretty jarring.

Additionally, you might not be aware of this file. The command in there is supposed to be executed to align the Theia editor preferences to the preferences in Monaco/vscode. Furthermore there are quite a few lines/methods annotated with @monaco-uplift that should be easily resolved with just 1-2 lines of changes.

@@ -173,9 +174,11 @@ const codeIconMap: Record<string, string> = {
'remote-explorer-view-icon': 'remote-explorer',
'review-comment-collapse': 'chevron-up',
'run-view-icon': 'debug-alt',
'runtime-extensions-editor-label-icon': ' extensions',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Is the space here intended?

Suggested change
'runtime-extensions-editor-label-icon': ' extensions',
'runtime-extensions-editor-label-icon': 'extensions',

@@ -229,24 +233,14 @@ const codeIconMap: Record<string, string> = {
'watch-expressions-add-function-breakpoint': 'add',
'watch-expressions-remove-all': 'close-all',
'watch-view-icon': 'debug-alt',
'widget-close': 'close'
'widget-close': 'close',
'workspace-trust-editor-label-icon': ' shield'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'workspace-trust-editor-label-icon': ' shield'
'workspace-trust-editor-label-icon': 'shield'

Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, I've noticed that the change breaks notebook support, see:

image

@tsmaeder
Copy link
Contributor Author

tsmaeder commented Feb 5, 2024

@msujew the performance hit vs. VS Code seems to be mostly due to the patched IConfigurationService we set up in monaco-frontend-module.ts. At least, if I just return a StandaloneConfigurationService, opening theia.d.ts performs similarly to VS Code. If there is worse performance in this branch I assume it's because with the new service override implementation, the patched service is used everywhere in Monaco (for example in editor contributions) where it might not have been before.

@tsmaeder
Copy link
Contributor Author

tsmaeder commented Feb 5, 2024

@msujew I believe the performance problem should be fixed with the latest commit. Can you give it a go?

@msujew msujew changed the title Upgrade Moncao dependency to 1.83.1 Upgrade Monaco dependency to 1.83.1 Feb 12, 2024
Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good to me. I couldn't find any further regressions and the performance is back to the before-change level.

Contributed on behalf of STMicroelectronics

Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
- Register vscode icons in registry instead of overriding ThemeIcon ids
  to codicon ids
- Use Monaco icon registry instead of adding our own icon stylying

Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
@tsmaeder tsmaeder merged commit e53924d into eclipse-theia:master Feb 15, 2024
14 checks passed
@pisv pisv mentioned this pull request Feb 15, 2024
1 task
@tsmaeder tsmaeder mentioned this pull request Feb 17, 2024
@msujew msujew added monaco issues related to monaco dependencies pull requests that update a dependency file labels Feb 21, 2024
@jfaltermeier jfaltermeier added this to the 1.47.0 milestone Feb 29, 2024
pisv added a commit to pisv/theia that referenced this pull request May 26, 2024
Before this fix, Monaco API KeybindingService.resolveKeybinding test was failing
on macOS with

```
AssertionError: expected { label: '⌃⇧⌥⌘K', …(6) } to deeply equal { label: '⌃⇧⌥⌘K', …(7) }
+ expected - actual

{
 "WYSIWYG": true
 "ariaLabel": "⌃⇧⌥⌘K"
+  "chord": false
 "dispatchParts": [
   "ctrl+shift+alt+meta+K"
 ]
 "electronAccelerator": "Ctrl+Shift+Alt+Cmd+K"
```

The `"chord": false` line was removed as part of eclipse-theia#13217 for other platforms.

This fix removes it for macOS.
@pisv pisv mentioned this pull request May 26, 2024
1 task
pisv added a commit to pisv/theia that referenced this pull request May 26, 2024
Before this fix, Monaco API KeybindingService.resolveKeybinding test was failing
on macOS with

```
AssertionError: expected { label: '⌃⇧⌥⌘K', …(6) } to deeply equal { label: '⌃⇧⌥⌘K', …(7) }
+ expected - actual

{
 "WYSIWYG": true
 "ariaLabel": "⌃⇧⌥⌘K"
+  "chord": false
 "dispatchParts": [
   "ctrl+shift+alt+meta+K"
 ]
 "electronAccelerator": "Ctrl+Shift+Alt+Cmd+K"
```

The `chord: false` was removed from the expected object for other platforms
as part of eclipse-theia#13217.

This fix removes it from the expected object for macOS.
tsmaeder pushed a commit that referenced this pull request May 31, 2024
Before this fix, Monaco API KeybindingService.resolveKeybinding test was failing
on macOS with

```
AssertionError: expected { label: '⌃⇧⌥⌘K', …(6) } to deeply equal { label: '⌃⇧⌥⌘K', …(7) }
+ expected - actual

{
 "WYSIWYG": true
 "ariaLabel": "⌃⇧⌥⌘K"
+  "chord": false
 "dispatchParts": [
   "ctrl+shift+alt+meta+K"
 ]
 "electronAccelerator": "Ctrl+Shift+Alt+Cmd+K"
```

The `chord: false` was removed from the expected object for other platforms
as part of #13217.

This fix removes it from the expected object for macOS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies pull requests that update a dependency file monaco issues related to monaco
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

monaco: upgrade @theia/monaco-editor-core
3 participants