Skip to content

Commit

Permalink
Add hover for breakpoint widget placeholder (#224356)
Browse files Browse the repository at this point in the history
* Add hover for breakpoint widget placeholder
Because it can easily be cut off in a slightly narrow editor
Fix #221506

* cast
  • Loading branch information
roblourens authored Jul 31, 2024
1 parent f7deb0a commit ddbd4f0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/vs/workbench/contrib/debug/browser/breakpointWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import * as dom from 'vs/base/browser/dom';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { Button } from 'vs/base/browser/ui/button/button';
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
import { ISelectOptionItem, SelectBox } from 'vs/base/browser/ui/selectBox/selectBox';
import { CancellationToken } from 'vs/base/common/cancellation';
import { onUnexpectedError } from 'vs/base/common/errors';
Expand Down Expand Up @@ -34,6 +35,7 @@ import * as nls from 'vs/nls';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { IHoverService } from 'vs/platform/hover/browser/hover';
import { IInstantiationService, createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
Expand Down Expand Up @@ -109,6 +111,7 @@ export class BreakpointWidget extends ZoneWidget implements IPrivateBreakpointWi
@IKeybindingService private readonly keybindingService: IKeybindingService,
@ILabelService private readonly labelService: ILabelService,
@ITextModelService private readonly textModelService: ITextModelService,
@IHoverService private readonly hoverService: IHoverService
) {
super(editor, { showFrame: true, showArrow: false, frameWidth: 1, isAccessible: true });

Expand Down Expand Up @@ -204,12 +207,12 @@ export class BreakpointWidget extends ZoneWidget implements IPrivateBreakpointWi

protected _fillContainer(container: HTMLElement): void {
this.setCssClass('breakpoint-widget');
const selectBox = new SelectBox(<ISelectOptionItem[]>[
const selectBox = new SelectBox([
{ text: nls.localize('expression', "Expression") },
{ text: nls.localize('hitCount', "Hit Count") },
{ text: nls.localize('logMessage', "Log Message") },
{ text: nls.localize('triggeredBy', "Wait for Breakpoint") },
], this.context, this.contextViewService, defaultSelectBoxStyles, { ariaLabel: nls.localize('breakpointType', 'Breakpoint Type') });
] satisfies ISelectOptionItem[], this.context, this.contextViewService, defaultSelectBoxStyles, { ariaLabel: nls.localize('breakpointType', 'Breakpoint Type') });
this.selectContainer = $('.breakpoint-select-container');
selectBox.render(dom.append(container, this.selectContainer));
selectBox.onDidSelect(e => {
Expand All @@ -221,6 +224,7 @@ export class BreakpointWidget extends ZoneWidget implements IPrivateBreakpointWi
this.createModesInput(container);

this.inputContainer = $('.inputContainer');
this.toDispose.push(this.hoverService.setupManagedHover(getDefaultHoverDelegate('mouse'), this.inputContainer, this.placeholder));
this.createBreakpointInput(dom.append(container, this.inputContainer));

this.input.getModel().setValue(this.getInputValue(this.breakpoint));
Expand Down

0 comments on commit ddbd4f0

Please sign in to comment.