-
Notifications
You must be signed in to change notification settings - Fork 2.6k
monaco hover popup hidden by the toolbar #14826
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
Comments
@kittaakos Thank you for the report. As it seems you have already analyzed the issue pretty well, would you be up for a contribution? |
I investigated the issue and found that it appears to be a minor user interface bug occurring when the toolbar is off. Proof (when the toolbar is off, the hover popup can overlay the menu with 2 pixels): ![]() Here's the explanation: Visual Studio Code has different pixel heights for the top and status bars, with the top bar 30px and the bottom bar 24px. In contrast, Theia uses a height of 32px for both the top bar and the toolbar:
and 22px for the bottom bar:
To address this issue, we will need to customize the In theory, the implementation is quite simple, Theia has to adjust the default pixel: export class MonacoContentHoverWidget extends ContentHoverWidget {
constructor(
editor: ICodeEditor,
contextKeyService: IContextKeyService,
configurationService: IConfigurationService,
accessibilityService: IAccessibilityService,
keybindingService: IKeybindingService
) {
super(editor, contextKeyService, configurationService, accessibilityService, keybindingService);
}
protected override _availableVerticalSpaceAbove(position: IPosition): number | undefined {
const value = super._availableVerticalSpaceAbove(position);
// VS Code uses 30 pixel for top height, but Theia uses 32 pixel
// `#theia-top-panel.min-height` (--theia-private-menubar-height)
// https://github.com/microsoft/vscode/blob/1430e1845cbf5ec29a2fc265f12c7fb5c3d685c3/src/vs/editor/contrib/hover/browser/resizableContentWidget.ts#L13
return typeof value === 'number' ? value - 2 : undefined;
}
protected override _availableVerticalSpaceBelow(position: IPosition): number | undefined {
const value = super._availableVerticalSpaceBelow(position);
// VS Code bottom height is only 20 pixels. but Theia uses 22 pixels
// `--theia-statusBar-height: 22px`
// https://github.com/microsoft/vscode/blob/1430e1845cbf5ec29a2fc265f12c7fb5c3d685c3/src/vs/editor/contrib/hover/browser/resizableContentWidget.ts#L14
return typeof value === 'number' ? value + 2 : undefined;
}
}
Update Never mind, I have figured it out. |
Customize the default `ContentHoverWidget` behavior to ensure it uses Theia styles when calculating available space for the hover widget. VS Code uses 30 pixel for top height, and 24 pixels for bottom height, but Theia uses 32 pixel for the top and 22 for the bottom. Closes eclipse-theia#14826
Customize the default `ContentHoverWidget` behavior to ensure it uses Theia styles when calculating available space for the hover widget. VS Code uses 30 pixel for top height, and 24 pixels for bottom height, but Theia uses 32 pixel for the top and 22 for the bottom. Closes #14826
Bug Description:
When the toolbar is activated using the shortcut Alt/⌥ + T, the layout may become incorrect, causing the monaco editor's hover popup to be hidden. This can make it challenging to read the information displayed in the hover.
Steps to Reproduce:
theia
in Theia and navigate to thepackages/property-view/src/browser/resource-property-view/index.ts
file (this is just an example; you can use any other file that has code elements triggering a hover in Monaco).Screen.Recording.2025-02-04.at.09.29.07.mov
Currently, it can be difficult to read when the toolbar is visible, depending on the space between the top panel and the popup. This issue arises because the popup's position is calculated relative to the
theia-top-panel
instead of themain-toolbar
, leading to improper placement.Expected behavior:
See how the popup's rect is correctly adjusted to the
theia-top-panel
when there is no toolbar.Screen.Recording.2025-02-04.at.10.05.06.mov
Additional Information
The text was updated successfully, but these errors were encountered: