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

monaco: adjust where the monaco menu appears #10909

Merged
merged 1 commit into from
Mar 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions packages/monaco/src/browser/monaco-quick-input-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
// *****************************************************************************

import {
ApplicationShell,
InputBox, InputOptions, KeybindingRegistry, PickOptions,
QuickInputButton, QuickInputHideReason, QuickInputService, QuickPick, QuickPickItem,
QuickPickItemButtonEvent, QuickPickItemHighlights, QuickPickOptions, QuickPickSeparator
} from '@theia/core/lib/browser';
import { injectable, inject } from '@theia/core/shared/inversify';
import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
import {
IInputBox, IInputOptions, IKeyMods, IPickOptions, IQuickInput, IQuickInputButton,
IQuickInputService, IQuickNavigateConfiguration, IQuickPick, IQuickPickItem, IQuickPickItemButtonEvent, IQuickPickSeparator, QuickPickInput
Expand Down Expand Up @@ -61,6 +62,9 @@ export class MonacoQuickInputImplementation implements IQuickInputService {
controller: QuickInputController;
quickAccess: IQuickAccessController;

@inject(ApplicationShell)
protected readonly shell: ApplicationShell;

@inject(VSCodeContextKeyService)
protected readonly contextKeyService: VSCodeContextKeyService;

Expand All @@ -71,7 +75,8 @@ export class MonacoQuickInputImplementation implements IQuickInputService {
get onShow(): monaco.IEvent<void> { return this.controller.onShow; }
get onHide(): monaco.IEvent<void> { return this.controller.onHide; }

constructor() {
@postConstruct()
protected init(): void {
this.initContainer();
this.initController();
this.quickAccess = new QuickAccessController(this, StandaloneServices.get(IInstantiationService));
Expand Down Expand Up @@ -149,15 +154,9 @@ export class MonacoQuickInputImplementation implements IQuickInputService {
}

private initContainer(): void {
const overlayWidgets = document.createElement('div');
overlayWidgets.classList.add('quick-input-overlay');
document.body.appendChild(overlayWidgets);
const container = this.container = document.createElement('quick-input-container');
container.style.position = 'absolute';
container.style.top = '0px';
container.style.right = '50%';
container.style.zIndex = '1000000';
overlayWidgets.appendChild(container);
const container = this.container = document.createElement('div');
container.id = 'quick-input-container';
this.shell.mainPanel.node.appendChild(this.container);
}

private initController(): void {
Expand Down
6 changes: 6 additions & 0 deletions packages/monaco/src/browser/style/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
font-size: inherit !important;
}

#quick-input-container {
position: fixed;
right: 50%;
z-index: 1000000;
}

/*
* set z-index to 0, so tabs are not above overlay widgets
*/
Expand Down