Skip to content

Conversation

@bpasero
Copy link
Member

@bpasero bpasero commented Nov 9, 2025

No description provided.

Copilot AI review requested due to automatic review settings November 9, 2025 13:00
@bpasero bpasero enabled auto-merge (squash) November 9, 2025 13:00
@bpasero bpasero self-assigned this Nov 9, 2025
@vs-code-engineering vs-code-engineering bot added this to the November 2025 milestone Nov 9, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new swipeToNavigate setting that enables navigation between open files using three-finger horizontal swipe gestures on macOS. The feature allows users to navigate to previously/next recently used editors by swiping left/right.

  • Adds workbench.editor.swipeToNavigate configuration option (macOS-only, non-web)
  • Implements swipe gesture handling in the Electron main process
  • Maps swipe left/right to corresponding editor navigation commands

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/vs/workbench/common/editor.ts Adds swipeToNavigate property to editor configuration interface
src/vs/workbench/browser/workbench.contribution.ts Registers the new configuration setting with description and platform constraints
src/vs/workbench/browser/parts/editor/editor.ts Adds default value and validation for swipeToNavigate option
src/vs/platform/windows/electron-main/windowImpl.ts Implements swipe event listener registration and handling logic

Comment on lines 1053 to 1061
// Swipe command support (macOS)
if (isMacintosh) {
const config = this.configurationService.getValue<IWorkbenchEditorConfiguration>();
if (config?.workbench?.editor?.swipeToNavigate) {
this.registerSwipeListener();
} else {
this._win.removeAllListeners('swipe');
}
}
Copy link

Copilot AI Nov 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The configuration check runs on every configuration update, not just when swipeToNavigate changes. This should use affectsConfiguration to check if the specific setting changed (like the menu bar and proxy settings below do). Without this check, registerSwipeListener() is called repeatedly whenever any configuration changes, which leads to multiple duplicate event listeners being registered for the 'swipe' event.

Copilot uses AI. Check for mistakes.
Comment on lines 1106 to 1118
private registerSwipeListener() {
this._win.on('swipe', (event: Electron.Event, cmd: string) => {
if (!this.isReady) {
return; // window must be ready
}

if (cmd === 'left') {
this.send('vscode:runAction', { id: 'workbench.action.openPreviousRecentlyUsedEditor', from: 'mouse' });
} else if (cmd === 'right') {
this.send('vscode:runAction', { id: 'workbench.action.openNextRecentlyUsedEditor', from: 'mouse' });
}
});
}
Copy link

Copilot AI Nov 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The swipe event listener is not properly managed for disposal. Each call to registerSwipeListener() adds a new listener without removing the previous one. The listener should be registered using this._register() with Event.fromNodeEventEmitter() (following the pattern used for other window events in setWin() method) to ensure proper cleanup when the window is disposed or the configuration changes.

Copilot uses AI. Check for mistakes.
@bpasero bpasero merged commit 5ed7107 into main Nov 9, 2025
28 checks passed
@bpasero bpasero deleted the ben/insufficient-flyingfish branch November 9, 2025 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants