Skip to content

Conversation

seivan
Copy link

@seivan seivan commented Aug 19, 2025

Defaults to disabled.
Not necessary if #875 is merged, so this is an alternative solution that would use an extension to handle the actual actions.

@Copilot Copilot AI review requested due to automatic review settings August 19, 2025 19:07
Copilot

This comment was marked as outdated.

Copy link

@Copilot 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

Adds swipe gesture recognition functionality to VS Code with an extension API. This implementation allows extensions to respond to left, right, up, and down swipe gestures on macOS trackpads.

  • Introduces a new configuration option workbench.editor.swipeGestureRecognizer (disabled by default)
  • Adds onDidReceiveSwipeGesture event to the extension API for handling swipe gestures
  • Implements gesture detection at the Electron window level for macOS

Reviewed Changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
workbench.contribution.ts Adds configuration setting for enabling swipe gesture recognition
extHostWindow.ts Adds swipe gesture event emitter and handler in extension host
extHost.protocol.ts Defines protocol interface for swipe gesture communication
extHost.api.impl.ts Exposes swipe gesture event in the public extension API
mainThreadWindow.ts Registers command to bridge swipe gestures from Electron to extension host
windowImpl.ts Implements native swipe gesture detection using Electron's swipe events

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +29 to +31
private _onDidReceiveSwipeGesture = new Emitter<'left' | 'right' | 'up' | 'down'>();

readonly onDidReceiveSwipeGesture: Event<'left' | 'right' | 'up' | 'down'> = this._onDidReceiveSwipeGesture.event;
Copy link
Preview

Copilot AI Aug 26, 2025

Choose a reason for hiding this comment

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

The swipe direction type 'left' | 'right' | 'up' | 'down' is repeated multiple times. Consider defining this as a type alias to improve maintainability and consistency across the codebase.

Suggested change
private _onDidReceiveSwipeGesture = new Emitter<'left' | 'right' | 'up' | 'down'>();
readonly onDidReceiveSwipeGesture: Event<'left' | 'right' | 'up' | 'down'> = this._onDidReceiveSwipeGesture.event;
private _onDidReceiveSwipeGesture = new Emitter<SwipeDirection>();
readonly onDidReceiveSwipeGesture: Event<SwipeDirection> = this._onDidReceiveSwipeGesture.event;

Copilot uses AI. Check for mistakes.

Comment on lines +743 to +745
private registerSwipeGesture(): void {

const configurationKey = 'workbench.editor.swipeGestureRecognizer';
Copy link
Preview

Copilot AI Aug 26, 2025

Choose a reason for hiding this comment

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

The configuration key string 'workbench.editor.swipeGestureRecognizer' is duplicated from workbench.contribution.ts. Consider defining this as a constant to avoid potential inconsistencies if the key name changes.

Copilot uses AI. Check for mistakes.

Comment on lines +755 to +760
const disposable = this._register(
Event.fromNodeEventEmitter(electronWindow, 'swipe',
(event: Electron.Event, direction: 'left' | 'right' | 'up' | 'down') => ({ event, direction }))((e) => {
this.sendWhenReady('vscode:runAction', CancellationToken.None, { id: '_workbench.triggerSwipeGesture', args: [e.direction] });

}));
Copy link
Preview

Copilot AI Aug 26, 2025

Choose a reason for hiding this comment

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

The command ID '_workbench.triggerSwipeGesture' is duplicated from mainThreadWindow.ts. Consider defining this as a constant to maintain consistency and prevent typos.

Copilot uses AI. Check for mistakes.

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.

1 participant