Skip to content

CodeLens: Run commands on completed clicks - #351284

Draft
Dmitriy Vasyura (dmitrivMS) wants to merge 1 commit into
mainfrom
fix/linux-codelens-pointer-133073
Draft

Dmitriy Vasyura (dmitrivMS) wants to merge 1 commit into
mainfrom
fix/linux-codelens-pointer-133073

Conversation

@dmitrivMS

Copy link
Copy Markdown
Collaborator

Fixes #133073.

Run CodeLens commands on a completed click rather than on mouse-down. A native X11 dialog can otherwise open while the pointer is still held, preventing both the dialog and other X11 applications from receiving clicks.

Keep the link and its icon attached when the command ID and visible title at that position are unchanged, but dispatch the latest command arguments. A provider or focus refresh no longer loses the click, and a changed action does not inherit the press. Dragging a selection onto a lens still does not activate it (#107736).

Verification: Manual steps, source-only fixture, and Fedora recording on the issue. Tested real provider/focus refreshes and cancelled gestures in Linux Chromium. Native macOS and Windows were not tested.

Automated checks:

  • pnpm run build-fast --client-only — passed.
  • node test/unit/browser/index.js --run src/vs/editor/contrib/codelens/test/browser/codelensWidget.test.ts --browser chromium --reporter dot — passed; the refresh assertion failed on the earlier click-only implementation.
  • pnpm run typecheck-client — passed.
  • pnpm run oxlint src/vs/editor/contrib/codelens/browser/codelensController.ts src/vs/editor/contrib/codelens/browser/codelensWidget.ts src/vs/editor/contrib/codelens/test/browser/codelensWidget.test.ts — passed.

Opening a native dialog on mouse-down can leave X11 pointer input grabbed. Execute on click instead, keeping an unchanged link attached across provider refreshes and dispatching its latest command arguments.

Fixes #133073

Co-authored-by: Copilot <[email protected]>
@dmitrivMS Dmitriy Vasyura (dmitrivMS) added this to the 1.150.0 milestone Nov 30, 2026
@dmitrivMS Dmitriy Vasyura (dmitrivMS) added linux Issues with VS Code on Linux editor-contrib Editor collection of extras labels Nov 30, 2026
Copilot AI balanced review requested due to automatic review settings November 30, 2026 18:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The CodeLens click handler lacks explicit teardown on replacement, removal, and widget disposal, allowing retained detached targets to retain command and widget/editor callbacks.

1 open issue
What changed in this PR

This PR moves CodeLens command execution from mouse-down to completed clicks, addressing the X11 modal-dialog input lockup while preserving protection against selection drags.

Changes:

  • Dispatch commands through link click handlers.
  • Preserve unchanged links and icons across refreshes while using the latest command arguments.
  • Add a regression test for refresh-spanning clicks and changed-command replacement.
File Description
src/​vs/​editor/​contrib/​codelens/​test/​browser/​codelensWidget.test.ts Tests target preservation, command replacement, and latest-argument dispatch.
src/​vs/​editor/​contrib/​codelens/​browser/​codelensWidget.ts Reuses unchanged rendered parts and handles completed clicks.
src/​vs/​editor/​contrib/​codelens/​browser/​codelensController.ts Removes mouse-down dispatch and passes command execution callbacks to widgets.

Review effort: Balanced

}
if (command?.id) {
// Even an unchanged link can have fresh command arguments after a provider refresh.
part.node.onclick = () => this._executeCommand(command);

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

editor-contrib Editor collection of extras linux Issues with VS Code on Linux

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Actions are unclickable in Modal dialog when opened through a CodeLens (and all mouse event on the system disabled)

2 participants