Files
x-sort-impuses/dist/extension.js
T
2026-09-03 21:01:59 +03:30

1 line
1.9 KiB
JavaScript

(()=>{"use strict";var t={265(t,e,n){var r,o=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(e,n);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,o)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),s=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||(r=function(t){return r=Object.getOwnPropertyNames||function(t){var e=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[e.length]=n);return e},r(t)},function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n=r(t),i=0;i<n.length;i++)"default"!==n[i]&&o(e,t,n[i]);return s(e,t),e});Object.defineProperty(e,"__esModule",{value:!0}),e.activate=function(t){let e=u.commands.registerCommand("x-sort-impuses.sortUsingsAndImports",()=>{const t=u.window.activeTextEditor;if(!t)return void u.window.showWarningMessage("No active editor found.");const e=t.document,n=e.getText().split(/\r?\n/),r=[],o=[];for(let t=0;t<n.length;t++){const e=n[t].trim(),s=e.startsWith("using ")||e.startsWith("import "),i=!e.startsWith("//")&&!e.startsWith("/*")&&!e.startsWith("*");s&&i&&(r.push(n[t]),o.push(t))}0!==r.length?(r.sort((t,e)=>t.length-e.length),t.edit(t=>{for(let n=0;n<o.length;n++){const s=o[n],i=e.lineAt(s).range;t.replace(i,r[n])}}).then(t=>{t&&u.window.showInformationMessage(`Successfully sorted ${r.length} imports/usings by length!`)})):u.window.showInformationMessage("No usings or imports found in this file.")});t.subscriptions.push(e)},e.deactivate=function(){};const u=i(n(398))},398(t){t.exports=require("vscode")}};const e={};let n=function n(r){const o=e[r];if(void 0!==o)return o.exports;const s=e[r]={exports:{}};return t[r].call(s.exports,s,s.exports,n),s.exports}(265);module.exports=n})();