| 1 |
- "use strict";var F=Object.create;var r=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var C=Object.getPrototypeOf,S=Object.prototype.hasOwnProperty;var b=(e,t)=>{for(var o in t)r(e,o,{get:t[o],enumerable:!0})},p=(e,t,o,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of P(t))!S.call(e,c)&&c!==o&&r(e,c,{get:()=>t[c],enumerable:!(s=$(t,c))||s.enumerable});return e};var u=(e,t,o)=>(o=e!=null?F(C(e)):{},p(t||!e||!e.__esModule?r(o,"default",{value:e,enumerable:!0}):o,e)),k=e=>p(r({},"__esModule",{value:!0}),e);var M={};b(M,{activate:()=>R,deactivate:()=>E});module.exports=k(M);var n=u(require("vscode"));var i=u(require("vscode"));function v(e){return`[${e}]`}function T(e,t,o,s,c){return`[${`${e} L${t}C${o}-L${s}C${c}`}]`}function L(e){return e.map(t=>v(t.filePath)).join("")}async function m(){let e=i.window.activeTextEditor;if(!e)return;let t=e.selection;if(t.isEmpty)return;let o=e.document,s=i.workspace.asRelativePath(o.uri),c=t.start.line+1,d=t.start.character+1,l=t.end.line+1,y=t.end.character+1,g=T(s,c,d,l,y);await i.env.clipboard.writeText(g),a(`$(clippy) Copied ${s}:${c}-${l}`)}async function f(){let e=i.window.activeTextEditor;if(!e)return;let t=e.document,o=i.workspace.asRelativePath(t.uri),s=v(o);await i.env.clipboard.writeText(s),a(`$(clippy) Copied file: ${o}`)}async function w(){let e=i.workspace.workspaceFolders;if(!e||e.length===0)return;let t=await i.window.showOpenDialog({canSelectFiles:!0,canSelectFolders:!1,canSelectMany:!0,openLabel:"Select files to copy as context"});!t||t.length===0||await h(t)}async function x(e){!e||e.length===0||await h(e)}async function h(e){let t=[];for(let s of e)try{await i.workspace.openTextDocument(s);let c=i.workspace.asRelativePath(s);t.push({filePath:c})}catch{}if(t.length===0)return;let o=L(t);await i.env.clipboard.writeText(o),a(`$(clippy) Copied ${t.length} file(s)`)}function a(e){i.window.setStatusBarMessage(e,3e3)}function R(e){console.log("[vsix-cp-ai-ctx] activating..."),e.subscriptions.push(n.commands.registerCommand("vsix-cp-ai-ctx.copySelection",()=>{m()})),e.subscriptions.push(n.commands.registerCommand("vsix-cp-ai-ctx.copyFile",()=>{f()})),e.subscriptions.push(n.commands.registerCommand("vsix-cp-ai-ctx.copyWorkspaceFiles",()=>{w()})),e.subscriptions.push(n.commands.registerCommand("vsix-cp-ai-ctx.copySelectedFiles",t=>{let o=t?.selectedResources||[];x(o)})),console.log("[vsix-cp-ai-ctx] activated")}function E(){}0&&(module.exports={activate,deactivate});
|