Skip to content

Discoverable context menu for disabling CodeLens#317267

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/disable-codelens-issue-fix
Draft

Discoverable context menu for disabling CodeLens#317267
Copilot wants to merge 2 commits into
mainfrom
copilot/disable-codelens-issue-fix

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 19, 2026

CodeLens has no in-UI affordance to identify or disable it — right-clicking a CodeLens currently invokes its command (often opening another file), and the only way to turn it off is the undocumented editor.codeLens setting.

Changes

  • New MenuId.EditorCodeLensContext — context menu shown when right-clicking a CodeLens widget, following the StickyScrollContext pattern.
  • codelensController.ts
    • Gate the lens click handler on e.event.leftButton so right-click no longer fires the lens command.
    • Add an onContextMenu handler that detects clicks inside .codelens-decoration and pops the new menu.
    • Register editor.action.toggleCodeLens (Action2, toggled against config.editor.codeLens), contributed to the Command Palette, View → Appearance menubar (group 4_editor, next to Sticky Scroll), and the new context menu.
    • Surface the existing codelens.showLensesInCurrentLine action in the same context menu, gated by EditorContextKeys.hasCodeLensProvider.

Notes

  • The toggle flips the global editor.codeLens setting; per-provider disable is out of scope.
  • Existing ContextMenuController already preventDefaults on CONTENT_WIDGET targets, so there is no native-menu conflict.

Copilot AI requested review from Copilot and removed request for Copilot May 19, 2026 07:32
Copilot AI linked an issue May 19, 2026 that may be closed by this pull request
Co-authored-by: dmitrivMS <9581278+dmitrivMS@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot May 19, 2026 07:44
Copilot AI changed the title [WIP] Fix issue with disabling CodeLens not being discoverable Discoverable context menu for disabling CodeLens May 19, 2026
Copilot AI requested a review from dmitrivMS May 19, 2026 07:45
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.

Disabling CodeLens Not Discoverable

2 participants