I'm trying to implement a command in my VSCode extension that auto-trims the document, leaving nothing left but the found text from the find widget (joined by newlines).
Example image:
Ideally when I run my command, the only text remaining in the document are the woff2 urls (from the above example).
Can I directly get the contents of all matches as an array? Or do I need to execute editor.action.selectHighlights (Select All Occurrences of Find Match) first, and then get the content that way?
I've tried executing await vscode.commands.executeCommand('editor.action.selectHighlights');, but mysteriously this only seems to work when the find widget is in regex mode.

This sequence of commands seems to work (at least as a keybinding):
so try using
editor.action.selectAllMatchesinstead ofeditor.action.selectHighlightsin your extension.