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

fix: quick input hover initialization #15064

Merged
merged 1 commit into from
Feb 26, 2025

Conversation

sdirix
Copy link
Member

@sdirix sdirix commented Feb 26, 2025

What it does

Makes sure the global Monaco BaseLayerHoverDelegate is properly initialized with Monaco's HoverService.

This fixes rendering issues caused by uncaught errors when opening a quick input, for example the command palette, before any Monaco editor was initialized. This scenario was easily reproducible in minimal Theia applications, not leveraging all offered Theia extensions.

fixes #15042

How to test

  • Adapt the browser example application and remove
    • all AI packages

    • all plugin packages

    • You can use this list for convenience:
      "@theia/console": "1.58.0",
      "@theia/core": "1.58.0",
      "@theia/editor": "1.58.0",
      "@theia/file-search": "1.58.0",
      "@theia/filesystem": "1.58.0",
      "@theia/keymaps": "1.58.0",
      "@theia/markers": "1.58.0",
      "@theia/messages": "1.58.0",
      "@theia/monaco": "1.58.0",
      "@theia/navigator": "1.58.0",
      "@theia/output": "1.58.0",
      "@theia/preview": "1.58.0",
      "@theia/workspace": "1.58.0"
      
  • Open the browser example on a workspace you did not use before, so that there are no "recent' entries in your quick input
  • Open the command palette Ctrl + Shift + P
  • Observe that the palette works as expected

Without the fix, the palette's rendering will be broken and errors thrown in the console


As an alternative reproducer you can use the Theia generator, there the problem immediately appears.

Follow-ups

  • This fixes the issue for the quick input. Previously I discussed with @tsmaeder to move this code to monaco-init. However as this change is less invasive, I put it into the quick input for now. moved to monaco-init
  • This fix should be backported to the community release

Breaking changes

  • This PR introduces breaking changes and requires careful review. If yes, the breaking changes section in the changelog has been updated.

Attribution

Review checklist

Reminder for reviewers

@sdirix sdirix requested a review from tsmaeder February 26, 2025 13:21
@sdirix sdirix force-pushed the fix-command-palette branch from d9953bd to 7977c36 Compare February 26, 2025 13:22
@tsmaeder
Copy link
Contributor

tsmaeder commented Feb 26, 2025

@sdirix I think I like the solution in monaco-init.ts better, here's why: if another service uses the hover delegate singleton, it might not be fixed with the current fix. You're saying the current solution is less intrusive, but I don't see how that is really the case: we're not really using any monaco services before monaco-init, (the overrides would not work if we do). It's easily testable whether the construction of the hover service works at that time. And we're overriding the singleton as soon as we're opening an editor anyway.
Since this is not relevant for Theia IDE, I would marge this PR after the Theia IDE release. If it needs to be backported for adopters, we should back-port it to the community release anyway, not 1..59

@sdirix
Copy link
Member Author

sdirix commented Feb 26, 2025

@sdirix I think I like the solution in monaco-init.ts better, here's why: if another service uses the hover delegate singleton, it might not be fixed with the current fix. You're saying the current solution is less intrusive, but I don't see how that is really the case: we're not really using any monaco services before monaco-init, (the overrides would not work if we do). It's easily testable whether the construction of the hover service works at that time. And we're overriding the singleton as soon as we're opening an editor anyway.

Okay I will try this too

Since this is not relevant for Theia IDE, I would marge this PR after the Theia IDE release. If it needs to be backported for adopters, we should back-port it to the community release anyway, not 1..59

If we don't include it in 1.59 then every user of the yeoman Theia generator will continue to experience the issue (as it will consume 1.59) as well as every adopter using a minimal Theia code base consuming 1.59 (and 1.58 in case we don't backport)

Makes sure the global Monaco BaseLayerHoverDelegate is properly
initialized with Monaco's HoverService.

This fixes rendering issues caused by uncaught errors when opening a
quick input, for example the command palette, before any Monaco editor
was initialized. This scenario was easily reproducible in minimal Theia
applications, not leveraging all offered Theia extensions.

fixes eclipse-theia#15042
@sdirix sdirix force-pushed the fix-command-palette branch from 7977c36 to e3cf158 Compare February 26, 2025 13:50
@sdirix
Copy link
Member Author

sdirix commented Feb 26, 2025

@tsmaeder updated the fix as discussed

@sdirix sdirix merged commit ec91680 into eclipse-theia:master Feb 26, 2025
10 of 11 checks passed
@github-actions github-actions bot added this to the 1.59.0 milestone Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
2 participants