-
Notifications
You must be signed in to change notification settings - Fork 37.2k
Fix/ai search copy all #284498 #285112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix/ai search copy all #284498 #285112
Conversation
There was a problem hiding this 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 fixes issue #284498 where the "Copy All" command in the search view wasn't distinguishing between normal search results and AI search results. The fix ensures that when copying all results, the command respects the context (AI or regular search) of the clicked element.
Key Changes:
- Modified
copyAllCommandto accept amatchparameter to determine the search context - Added
isAISearchResulthelper function to identify if an element belongs to AI search results - Updated
CopyAllCommandAction.run()to pass the match parameter through to the command
| async function copyAllCommand(accessor: ServicesAccessor, match: RenderableMatch | undefined) { | ||
| const viewsService = accessor.get(IViewsService); | ||
| const clipboardService = accessor.get(IClipboardService); | ||
| const labelService = accessor.get(ILabelService); | ||
|
|
||
| const searchView = getSearchView(viewsService); | ||
| if (searchView) { | ||
| const root = searchView.searchResult; | ||
| const isAISearchElement = isAISearchResult(match); | ||
|
|
||
| const text = allFolderMatchesToString(root.folderMatches(), labelService); | ||
| const text = allFolderMatchesToString(root.folderMatches(isAISearchElement), labelService); | ||
| await clipboardService.writeText(text); | ||
| } | ||
| } |
Copilot
AI
Dec 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the match parameter is undefined (e.g., when invoked without a specific context), the function should fall back to getting the selected row using getSelectedRow(), similar to copyMatchCommand(). Currently, if match is undefined, isAISearchResult(match) returns false, which means the command will always copy plain text search results even when the user is in the AI search context. This could result in copying the wrong search results.
Consider adding a fallback:
if (!match) {
match = getSelectedRow(accessor);
}before calling isAISearchResult(match).
Fixes issue #284498
The issue was caused by the fact that the copyAllCommand wasn't considering whether the click was done on normal searches or ai searches.
Test it:
Go to search -> AI Search
Search for anything
Right click on any result and select 'Copy All'
Paste the copied contents into a file and check if they correspond.