|
@@ -24,14 +24,26 @@ export function activate(context: vscode.ExtensionContext) {
|
|
|
|
|
|
|
|
context.subscriptions.push(
|
|
context.subscriptions.push(
|
|
|
vscode.commands.registerCommand('copy-ai-ctx.copySelectedFiles', (args) => {
|
|
vscode.commands.registerCommand('copy-ai-ctx.copySelectedFiles', (args) => {
|
|
|
- if (!args) return;
|
|
|
|
|
|
|
+ if (!args) {
|
|
|
|
|
+ // keyboard shortcut invocation: fallback to active editor file
|
|
|
|
|
+ const editor = vscode.window.activeTextEditor;
|
|
|
|
|
+ if (!editor) return;
|
|
|
|
|
+ copySingleItem(editor.document.uri);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
copySingleItem(args as vscode.Uri);
|
|
copySingleItem(args as vscode.Uri);
|
|
|
}),
|
|
}),
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
context.subscriptions.push(
|
|
context.subscriptions.push(
|
|
|
vscode.commands.registerCommand('copy-ai-ctx.copyMultiFiles', (...args) => {
|
|
vscode.commands.registerCommand('copy-ai-ctx.copyMultiFiles', (...args) => {
|
|
|
- if (args.length < 2) return;
|
|
|
|
|
|
|
+ if (args.length < 2) {
|
|
|
|
|
+ // keyboard shortcut invocation: fallback to active editor file
|
|
|
|
|
+ const editor = vscode.window.activeTextEditor;
|
|
|
|
|
+ if (!editor) return;
|
|
|
|
|
+ copyMultiFiles([editor.document.uri]);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
// args[0] = clicked resource URI
|
|
// args[0] = clicked resource URI
|
|
|
// args[1] might be array (standard) or individual URI (variadic)
|
|
// args[1] might be array (standard) or individual URI (variadic)
|
|
|
const resources = Array.isArray(args[1]) ? args[1] : args.slice(1);
|
|
const resources = Array.isArray(args[1]) ? args[1] : args.slice(1);
|