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

"bad scroll event" occurring in Command Palette in Theia if the application does not include the "@theia/ai-chat-ui" module #15042

Closed
Tracked by #15076
xpomul opened this issue Feb 25, 2025 · 1 comment · Fixed by #15064
Assignees
Labels

Comments

@xpomul
Copy link

xpomul commented Feb 25, 2025

Bug Description:

When starting to develop a fresh extension using the yeoman code generator, the default electron-app and browser-app folders each contain a package.json listing a minimum Theia environment as dependencies.

But when I build an run these applications, and in the fresh, empty Theia application, I invoke the Command Palette (using CMD+SHIFT+P), the Command Palette is not cleanly formatted, but looks distorted.
Additionally, on the console, this error is logged:

ERROR Got bad scroll event: {
  inSmoothScrolling: false,
  oldWidth: 0,
  oldScrollWidth: 0,
  oldScrollLeft: 0,
  width: 0,
  scrollWidth: 0,
  scrollLeft: 0,
  oldHeight: 0,
  oldScrollHeight: 0,
  oldScrollTop: 0,
  height: 226,
  scrollHeight: 1980,
  scrollTop: 0,
  widthChanged: false,
  scrollWidthChanged: false,
  scrollLeftChanged: false,
  heightChanged: true,
  scrollHeightChanged: true,
  scrollTopChanged: false
}

I have started to debug this by including the full set of dependencies from Theia IDE and one by one stripping them.
For some reason, the problem seems to be that the "@theia/ai-chat-ui" dependency is missing, because, when I add it to the minimal application, the Command Palette works as expected; but when I remove it again, the Command Palette is distorted again.

Maybe there is an implicit dependency somewhere that causes this? (Or it is a transitive dependency of the ai-chat-ui module ...?).

In any case, the yeoman generator should be fixed to include the necessary dependency (or better yet, if it is really the missing ai-chat-ui module that causes this, I would expect the minimal Theia to even work fine without any AI module installed...).

Steps to Reproduce:

  1. Start in an empty directory and invoke yo theia-extension
  2. Create the HelloWorld extension
  3. Start yarn && yarn build:electron && yarn start:electron
  4. In the launched Theia application, bring up the Command Palette using CMD+SHIFT+P

Additional Information

  • Operating System: MacOS 15.3 (24D60) (M1 Max / arm64)
  • Theia Version: 1.58.3
  • generator-theia-extension@0.1.40
@sdirix
Copy link
Member

sdirix commented Feb 25, 2025

Observations:

  • I can reproduce the issue with Theia 1.58.3 used in a Theia based application
  • I can still reproduce the issue when using prerelease 1.59.0-next.72
  • I can still reproduce the issue when consuming the latest master 3dde0acabee in the Theia based application
  • I can reproduce that only adding the AI packages solves the issue. Adding all Theia packages BUT the AI packages does not solve the issue.
  • Using the example application in the Theia repository:
    • I can not reproduce the issue when removing all AI packages (and sample packages to avoid including the AI packages transitively)
    • I can reproduce the issue when removing all AI packages (and sample packages) AND plugin packages
    • I can not reproduce the issue when removing all plugin packages but still use the AI packages
  • Adding the plugin packages to the Theia based application (and not the AI packages), the issue occurs about 50% of the time on my machine
  • It seems to be an initial case issue, once at least one element is per default in the "recent" list, for example by having an open editor or executing a command, the issue no longer occurs
  • I checked why adding @theia/ai-chat-ui is fixing the issue: The creation of this inline editor seems to fix the command palette / quick input as a side effect.
  • The error occurs here because hover at the time of access is null. It's null because it's initialized here via here. The error does not occur when a Monaco was initialized, because the baseHoverDelegate is then overwritten here. Overall this seems like a bug in Monaco, I don't know why they violate their own interface and return null in the default delegate.

sdirix added a commit to eclipsesource/theia that referenced this issue Feb 26, 2025
Makes sure the global Monaco BaseLayerHoverDelegate is properly
initialized with Monaco's HoverService before opening a quick input.

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 added a commit to eclipsesource/theia that referenced this issue Feb 26, 2025
Makes sure the global Monaco BaseLayerHoverDelegate is properly
initialized with Monaco's HoverService before opening a quick input.

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 added a commit to eclipsesource/theia that referenced this issue Feb 26, 2025
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 added a commit that referenced this issue Feb 26, 2025
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants