-
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
[Bug] Regression in 0.45.0 - Command Palette does not work if Monaco is wrapped in Angular #4372
Comments
Can you reproduce this in the monaco editor playground? |
I know one could say it's an NG problem, but something must have happend to the monaco code that is responsible for the incompatibility with NG since 0.44.0 works perfectly. |
We do have a call to but... I mean that hasn't changed in years. It seems like a reasonable claim that for some reason The only interesting call to The getter & setter for and The other side of the coin is if for some reason we fail to get the Commands ...and that somehow sets a non-array type...but that doesn't seem to be the case: We return an array here: We return an array here: and the only change that went in between 0.44.0 and 0.45.0 is this which wouldn't cause the issue: Is it possible some mangling could be going on @FSDRE? Can you please provide a minimum repro so that it's easier to debug? I'd also be curious if other quick picks, like symbols, also fail. |
@TylerLeonhardt Mangling is not used. Monaco gets copied 1:1 from node_modules to the assets folder: {
"glob": "**/*",
"input": "node_modules/monaco-editor/min/vs",
"output": "assets/monaco/min/vs"
},
{
"glob": "**/*",
"input": "node_modules/monaco-editor/min-maps/vs",
"output": "assets/monaco/min-maps/vs"
} This does not run through any of NG's build processes where minification or mangling is applied. The Now here's the weird part: I checked all your above mentioned links and you are right, I don't see any issues, too. But fact is, if I hit this.elements = inputElements.reduce((result, item, index) => { it gets called twice. On the first call Now the question I cannot answer is, where does the Promise come from? The Promise is even there if I run the The provided repo is as minimal as it gets. It's the minimal size of a running NG-App. If you run Chrome with I am also investing more time into the issue since I need it fixed and I really want to know what's going on. It's a weird one for sure 😄 |
Ok I got to the culprit of it: Don't call me insane, but this line gets called even if if I put providedPicks instanceof Promise into the browser watch it returns This is a honest WTF-moment... what is going on here? It might be that zone.js could be the issue, don't really know yet. |
If I use Monaco 0.44.0, As soon as I use 0.45.0, |
Wait in |
I am confused and I am honstly not sure if I am understanding this correctly. I made 2 screenshots. In 0.44.0 In 0.45.0 What confuses me is that in both cases the watcher shows Can you make any sense of that? |
Honestly not sure what could be happening here. This is going to be tricky for us to track down without a simple repro. I can't say that we'll have the time to look deep into this... but if you find a solution and the PR is small we would for sure consider taking it. I'm very suspicious of some hijacking of the global Promise which is causing this. |
What is your definition of a simple repo? Since you need the Angular wrapper, the given one is as simple as one could provide it. I cannot really make it any smaller. I understand that this issue may not be of your concern and I am positive that Angular somehow monkey-patches the global Promise in order to achieve its zone-aware change detection. It's not a Monaco issue per se. With the knowledge about the ZoneAwarePromise, I will try to post this in the Angular repo. I myself am not able to pin down the actual root cause of the behavior. Nevertheless, thanks for your input and the maintainance of the editor! |
The problem occurres exactly since v0.45.0-dev-20231125. Since zone.js has a big (still unsolved) problem with native async/await (angular/angular#31730) this change causes the Problem. |
We cannot revert that because of the angular zone library having issues with native promises. I'm sorry that it broke for you, but this is yet another proof that we can only investigate issues that reproduce in the monaco editor playground. |
Thats fine for me. |
Reproducible in vscode.dev or in VS Code Desktop?
Reproducible in the monaco editor playground?
Monaco Editor Playground Link
Minimal Example:
https://github.com/FrameworkSystemsGmbH/AngularMonaco
Monaco Editor Playground Code
No response
Reproduction Steps
npm i
npm run serve
Actual (Problematic) Behavior
If Monaco 0.45.0 is wrapped within an Angular App, the Command Palette is empty.
The console shows this error:
Expected Behavior
The Command Palette should work correctly. Latest working version is 0.44.0
Additional Context
I have tried Angular 15.x, 16.x and 17.x to no avail.
Downgrading to Monaco 0.44.0 fixes the issue.
Loading Monaco with loader.js in a plain HTML-File works fine.
The text was updated successfully, but these errors were encountered: