Skip to content

Add remove button to Command Palette recently used commands#278276

Merged
TylerLeonhardt merged 3 commits intomainfrom
copilot/add-remove-button-recently-used
Nov 21, 2025
Merged

Add remove button to Command Palette recently used commands#278276
TylerLeonhardt merged 3 commits intomainfrom
copilot/add-remove-button-recently-used

Conversation

Copy link
Contributor

Copilot AI commented Nov 19, 2025

Adds an "X" button to remove individual commands from the Command Palette's "recently used" section. Button appears only for recently used items, positioned rightmost after the existing "Configure Keybinding" button.

Changes

src/vs/platform/quickinput/browser/commandsQuickAccess.ts:

  • Added CommandsHistory.remove() method to delete entries from LRU cache
  • Modified _getPicks() to use isInHistory to identify recently used items
  • Updated toCommandPick() to:
    • Accept isRecentlyUsed parameter (passed as isInHistory)
    • Append close button with "Remove from Recently Used" tooltip for recently used items only
    • Implement trigger handler that calls commandsHistory.remove() and returns TriggerAction.REMOVE_ITEM

Button uses Codicon.close icon, positioned as last button element (rightmost). Follows existing pattern from "Remove from Recently Opened" in file picker.

Fixes #issue_number

<issue_title>Add "X" button to remove command from "recently used" list in Command Palette</issue_title>
><issue_description>The Command Palette in VS Code keeps track of the top 50 most recently used commands used, and shows them at the top of the filtered commands lists if they apply to the given search. There should be an X button next to each Command Palette item in the "recently used" quickpick section. The X button should show the tooltip "Remove from recently used", properly localized. This button should not appear for items in sections "other commands" nor "similar commands".</issue_description>
>
> ## Comments on the Issue (you are @copilot in this section)
>
>
>

Original prompt

This section details on the original issue you should resolve

<issue_title>Add "X" button to remove command from "recently used" list in Command Palette</issue_title>
<issue_description>The Command Palette in VS Code keeps track of the top 50 most recently used commands used, and shows them at the top of the filtered commands lists if they apply to the given search. There should be an X button next to each Command Palette item in the "recently used" quickpick section. The X button should show the tooltip "Remove from recently used", properly localized. This button should not appear for items in sections "other commands" nor "similar commands".</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add X button to remove command from recently used list Add remove button to Command Palette recently used commands Nov 19, 2025
Copilot AI requested a review from jruales November 19, 2025 07:09
@jruales
Copy link
Contributor

jruales commented Nov 19, 2025

@copilot no need for keeping track of isRecentlyUsedSection. You can just use isInHistory

Copy link
Contributor Author

Copilot AI commented Nov 19, 2025

@copilot no need for keeping track of isRecentlyUsedSection. You can just use isInHistory

Simplified the code by removing isRecentlyUsedSection and using isInHistory directly in commit fc37940. The logic remains the same since items in history naturally appear in the "recently used" section due to sorting.

@jruales
Copy link
Contributor

jruales commented Nov 20, 2025

Validated functionality:

Icon appears
image

Has correct tooltip
image

When pressed, removes item from recently used
image

@jruales jruales requested review from TylerLeonhardt and removed request for jruales November 20, 2025 01:56
@jruales jruales marked this pull request as ready for review November 20, 2025 01:57
Copilot AI review requested due to automatic review settings November 20, 2025 01:57
@jruales jruales force-pushed the copilot/add-remove-button-recently-used branch from fc37940 to fbd7dbe Compare November 20, 2025 01:58
@vs-code-engineering vs-code-engineering bot added this to the November 2025 milestone Nov 20, 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 remove button ("X") to individual commands in the Command Palette's "recently used" section, allowing users to remove specific commands from their recent history. The implementation follows existing patterns from similar features like "Remove from Recently Opened" in the file picker.

Key changes:

  • Added CommandsHistory.remove() method to delete entries from the LRU cache
  • Modified toCommandPick() to conditionally add a close button with localized tooltip for recently used items
  • Implemented trigger handler that removes items from history and returns TriggerAction.REMOVE_ITEM

@TylerLeonhardt TylerLeonhardt added the ~copilot-video-please ⚠️WIP🏗️ Use in PRs. Runs Copilot CLI agent to record a video of "trying out the change" label Nov 20, 2025
@vs-code-engineering vs-code-engineering bot removed the ~copilot-video-please ⚠️WIP🏗️ Use in PRs. Runs Copilot CLI agent to record a video of "trying out the change" label Nov 20, 2025
@vs-code-engineering
Copy link

🤖 Copilot has tried out this change! Members of the team can view the recording here or download the Playwright trace here (run)

@TylerLeonhardt TylerLeonhardt enabled auto-merge (squash) November 21, 2025 21:03
@TylerLeonhardt TylerLeonhardt merged commit 157bd3e into main Nov 21, 2025
28 checks passed
@TylerLeonhardt TylerLeonhardt deleted the copilot/add-remove-button-recently-used branch November 21, 2025 21:04
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Jan 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add "X" button to remove command from "recently used" list in Command Palette

4 participants