You can set up a multiple selection in the VS Code explorer pane. Right-clicking on the selection fires a context menu and as you can see in the screen capture I have contributed a Print item to this menu.
The menu item contribution binds it to a command.
"menus": {
"explorer/context": [
{
"command": "vsc-print.print",
"group": "navigation"
}
],
Activation registers the command.
context.subscriptions.push(vscode.commands.registerCommand("vsc-print.print", printCommand));
When the command executes this is called.
function printCommand(cmdArgs: any): PrintSession {
logger.debug("Print command was invoked");
const printSession = new PrintSession(cmdArgs, false);
printSessions.set(printSession.sessionId, printSession);
return printSession;
}
Contrary to expectation, cmdArgs
is not an array of vscode.Uri
. All you get is the vscode.Uri
for the file under the right-click, highlighted by a blue border in the illustration above.
Documentation describes only the contribution of additional view containers. There is no mention of how to get my hooks into baked-in stuff. Can anyone tell me how to get the list of selected files?