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

debt - address some todos #192845

Merged
merged 1 commit into from
Sep 12, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 0 additions & 6 deletions src/vs/workbench/electron-sandbox/desktop.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,6 @@ import { applicationConfigurationNodeBase } from 'vs/workbench/common/configurat
'scope': ConfigurationScope.APPLICATION,
'description': localize('titleBarStyle', "Adjust the appearance of the window title bar. On Linux and Windows, this setting also affects the application and context menu appearances. Changes require a full restart to apply.")
},
'window.experimental.nativeContextMenuLocation': { // TODO@bpasero remove me eventually
'type': 'boolean',
'default': true,
'scope': ConfigurationScope.APPLICATION,
'description': localize('nativeContextMenuLocation', "Let the OS handle positioning of the context menu in cases where it should appear under the mouse.")
},
'window.dialogStyle': {
'type': 'string',
'enum': ['native', 'custom'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class ContextMenuService implements IContextMenuService {

// Native context menu: otherwise
else {
this.impl = new NativeContextMenuService(notificationService, telemetryService, keybindingService, menuService, contextKeyService, configurationService);
this.impl = new NativeContextMenuService(notificationService, telemetryService, keybindingService, menuService, contextKeyService);
}
}

Expand All @@ -77,28 +77,14 @@ class NativeContextMenuService extends Disposable implements IContextMenuService
private readonly _onDidHideContextMenu = this._store.add(new Emitter<void>());
readonly onDidHideContextMenu = this._onDidHideContextMenu.event;

private useNativeContextMenuLocation = false;

constructor(
@INotificationService private readonly notificationService: INotificationService,
@ITelemetryService private readonly telemetryService: ITelemetryService,
@IKeybindingService private readonly keybindingService: IKeybindingService,
@IMenuService private readonly menuService: IMenuService,
@IContextKeyService private readonly contextKeyService: IContextKeyService,
@IConfigurationService private readonly configurationService: IConfigurationService
@IContextKeyService private readonly contextKeyService: IContextKeyService
) {
super();

this.updateUseNativeContextMenuLocation();
this._register(this.configurationService.onDidChangeConfiguration(e => {
if (e.affectsConfiguration('window.experimental.nativeContextMenuLocation')) {
this.updateUseNativeContextMenuLocation();
}
}));
}

private updateUseNativeContextMenuLocation(): void {
this.useNativeContextMenuLocation = this.configurationService.getValue<boolean>('window.experimental.nativeContextMenuLocation') === true;
}

showContextMenu(delegate: IContextMenuDelegate | IContextMenuMenuDelegate): void {
Expand Down Expand Up @@ -173,13 +159,8 @@ class NativeContextMenuService extends Disposable implements IContextMenuService
x = anchor.x;
y = anchor.y;
} else {
if (this.useNativeContextMenuLocation) {
// We leave x/y undefined in this case which will result in
// Electron taking care of opening the menu at the cursor position.
} else {
x = anchor.posx + 1; // prevent first item from being selected automatically under mouse
y = anchor.posy;
}
// We leave x/y undefined in this case which will result in
// Electron taking care of opening the menu at the cursor position.
}

if (typeof x === 'number') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ suite('StoredFileWorkingCopy', function () {
});
});

test.skip('save (errors)', async () => { // TODO@bpasero enable again
test('save (errors)', async () => {
let savedCounter = 0;
disposables.add(workingCopy.onDidSave(reason => {
savedCounter++;
Expand Down