commit 038e1f4b26092ee46650712a3084b73a3707981f Author: Hadi Khazaee Asl Date: Thu Sep 3 21:01:59 2026 +0330 Initial Commit ... diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..45e49cf --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +# +*.vsix +node_modules +package-lock.json \ No newline at end of file diff --git a/.vscode-test.mjs b/.vscode-test.mjs new file mode 100644 index 0000000..b62ba25 --- /dev/null +++ b/.vscode-test.mjs @@ -0,0 +1,5 @@ +import { defineConfig } from '@vscode/test-cli'; + +export default defineConfig({ + files: 'out/test/**/*.test.js', +}); diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..dd01eb3 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + // See http://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format + "recommendations": ["dbaeumer.vscode-eslint", "amodio.tsl-problem-matcher", "ms-vscode.extension-test-runner"] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..c42edc0 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,21 @@ +// A launch configuration that compiles the extension and then opens it inside a new window +// Use IntelliSense to learn about possible attributes. +// Hover to view descriptions of existing attributes. +// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Run Extension", + "type": "extensionHost", + "request": "launch", + "args": [ + "--extensionDevelopmentPath=${workspaceFolder}" + ], + "outFiles": [ + "${workspaceFolder}/dist/**/*.js" + ], + "preLaunchTask": "${defaultBuildTask}" + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..734a3e4 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,13 @@ +// Place your settings in this file to overwrite default and user settings. +{ + "files.exclude": { + "out": false, // set this to true to hide the "out" folder with the compiled JS files + "dist": false // set this to true to hide the "dist" folder with the compiled JS files + }, + "search.exclude": { + "out": true, // set this to false to include "out" folder in search results + "dist": true // set this to false to include "dist" folder in search results + }, + // Turn off tsc task auto detection since we have the necessary tasks as npm scripts + "js/ts.tsc.autoDetect": "off" +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..c2ab68a --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,40 @@ +// See https://go.microsoft.com/fwlink/?LinkId=733558 +// for the documentation about the tasks.json format +{ + "version": "2.0.0", + "tasks": [ + { + "type": "npm", + "script": "watch", + "problemMatcher": "$ts-webpack-watch", + "isBackground": true, + "presentation": { + "reveal": "never", + "group": "watchers" + }, + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "type": "npm", + "script": "watch-tests", + "problemMatcher": "$tsc-watch", + "isBackground": true, + "presentation": { + "reveal": "never", + "group": "watchers" + }, + "group": "build" + }, + { + "label": "tasks: watch-tests", + "dependsOn": [ + "npm: watch", + "npm: watch-tests" + ], + "problemMatcher": [] + } + ] +} diff --git a/.vscodeignore b/.vscodeignore new file mode 100644 index 0000000..d255964 --- /dev/null +++ b/.vscodeignore @@ -0,0 +1,14 @@ +.vscode/** +.vscode-test/** +out/** +node_modules/** +src/** +.gitignore +.yarnrc +webpack.config.js +vsc-extension-quickstart.md +**/tsconfig.json +**/eslint.config.mjs +**/*.map +**/*.ts +**/.vscode-test.* diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..c7832e9 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,9 @@ +# Change Log + +All notable changes to the "x-sort-impuses" extension will be documented in this file. + +Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. + +## [Unreleased] + +- Initial release \ No newline at end of file diff --git a/Documents/Instructions.md b/Documents/Instructions.md new file mode 100644 index 0000000..79b7540 --- /dev/null +++ b/Documents/Instructions.md @@ -0,0 +1,17 @@ +# Instructions + +```sh +# +# installing node ... +nvm install 24.20.0 +nvm use 24.20.0 + +# +# installing required packages ... +pm install -g yo generator-code @vscode/vsce + +# +# Build and Debug Extension ... +# compile it to .vsix +vsce package +``` diff --git a/README.md b/README.md new file mode 100644 index 0000000..51e2bae --- /dev/null +++ b/README.md @@ -0,0 +1,25 @@ +# x-sort-impuses README + +this Extension use to Sort import(s) and using(s) lines based on their length ... + +## Features + +using command pallete or context menu to do sorting ... + +## Requirements + +## Extension Settings + +## Known Issues + +## Release Notes + +### 1.0.0 + +## Maintainer + +Hadi Khazaee asl + +[https://www.saherelm.ir](https://www.saherelm.ir) + +[hadi_khazaee_asl@yahoo.com](mailto:hadi_khazaee_asl@yahoo.com) diff --git a/dist/extension.js b/dist/extension.js new file mode 100644 index 0000000..d047b6e --- /dev/null +++ b/dist/extension.js @@ -0,0 +1 @@ +(()=>{"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{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;tt.length-e.length),t.edit(t=>{for(let n=0;n{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})(); \ No newline at end of file diff --git a/dist/extension.js.map b/dist/extension.js.map new file mode 100644 index 0000000..f11fa95 --- /dev/null +++ b/dist/extension.js.map @@ -0,0 +1 @@ +{"version":3,"file":"extension.js","mappings":"k3BAGAA,EAAAC,SAAA,SAAyBC,GAGvB,IAAIC,EAAaC,EAAOC,SAASC,gBAC/B,sCACA,KAGE,MAAMC,EAASH,EAAOI,OAAOC,iBAC7B,IAAKF,EAEH,YADAH,EAAOI,OAAOE,mBAAmB,2BAKnC,MAAMC,EAAWJ,EAAOI,SAKlBC,EAJOD,EAASE,UAIHC,MAAM,SAGnBC,EAAwB,GACxBC,EAA0B,GAIhC,IAAK,IAAIC,EAAI,EAAGA,EAAIL,EAAMM,OAAQD,IAAK,CAErC,MAAME,EAAcP,EAAMK,GAAGG,OAKvBC,EACJF,EAAYG,WAAW,WAAaH,EAAYG,WAAW,WACvDC,GACHJ,EAAYG,WAAW,QACvBH,EAAYG,WAAW,QACvBH,EAAYG,WAAW,KAGtBD,GAAmBE,IAErBR,EAAYS,KAAKZ,EAAMK,IACvBD,EAAcQ,KAAKP,GAEvB,CAG2B,IAAvBF,EAAYG,QAUhBH,EAAYU,KAAK,CAACC,EAAGC,IAAMD,EAAER,OAASS,EAAET,QAKxCX,EACGqB,KAAMC,IACL,IAAK,IAAIZ,EAAI,EAAGA,EAAID,EAAcE,OAAQD,IAAK,CAE7C,MAAMa,EAAYd,EAAcC,GAC1Bc,EAAYpB,EAASqB,OAAOF,GAAWG,MAI7CJ,EAAYK,QAAQH,EAAWhB,EAAYE,GAC7C,IAEDkB,KAAMC,IACDA,GAEFhC,EAAOI,OAAO6B,uBACZ,uBAAuBtB,EAAYG,uCA7BzCd,EAAOI,OAAO6B,uBACZ,8CAsCRnC,EAAQoC,cAAcd,KAAKrB,EAC7B,EAGAH,EAAAuC,WAAA,WAA8B,EAnG9B,MAAAnC,EAAAoC,EAAAC,EAAA,K,SCAAC,EAAA1C,QAAA2C,QAAA,S,GCCA,MAAAC,EAAA,GCEA,IAAAC,EDCA,SAAAJ,EAAAK,GAEA,MAAAC,EAAAH,EAAAE,GACA,QAAAE,IAAAD,EACA,OAAAA,EAAA/C,QAGA,MAAA0C,EAAAE,EAAAE,GAAA,CAGA9C,QAAA,IAOA,OAHAiD,EAAAH,GAAAI,KAAAR,EAAA1C,QAAA0C,EAAAA,EAAA1C,QAAAyC,GAGAC,EAAA1C,OACA,CCnBAyC,CAAA,K","sources":["webpack://x-sort-impuses/./src/extension.ts","webpack://x-sort-impuses/external commonjs \"vscode\"","webpack://x-sort-impuses/webpack/bootstrap","webpack://x-sort-impuses/webpack/startup"],"sourcesContent":["import * as vscode from \"vscode\";\n\n//\nexport function activate(context: vscode.ExtensionContext) {\n //\n // 1. Register the command that will be triggered by the user\n let disposable = vscode.commands.registerCommand(\n \"x-sort-impuses.sortUsingsAndImports\",\n () => {\n //\n // 2. Get the active text editor\n const editor = vscode.window.activeTextEditor;\n if (!editor) {\n vscode.window.showWarningMessage(\"No active editor found.\");\n return;\n }\n\n //\n const document = editor.document;\n const text = document.getText();\n\n //\n // Split text into lines (handling both Windows \\r\\n and Linux/Mac \\n)\n const lines = text.split(/\\r?\\n/);\n\n //\n const importLines: string[] = [];\n const importIndices: number[] = [];\n\n //\n // 3. Identify all 'using' and 'import' lines\n for (let i = 0; i < lines.length; i++) {\n //\n const trimmedLine = lines[i].trim();\n\n //\n // Check if the line starts with 'using ' or 'import '\n // We also ensure it's not a comment\n const isImportOrUsing =\n trimmedLine.startsWith(\"using \") || trimmedLine.startsWith(\"import \");\n const isNotComment =\n !trimmedLine.startsWith(\"//\") &&\n !trimmedLine.startsWith(\"/*\") &&\n !trimmedLine.startsWith(\"*\");\n\n //\n if (isImportOrUsing && isNotComment) {\n //\n importLines.push(lines[i]); // Store the original line (with its indentation)\n importIndices.push(i); // Store its line number\n }\n }\n\n //\n if (importLines.length === 0) {\n //\n vscode.window.showInformationMessage(\n \"No usings or imports found in this file.\",\n );\n return;\n }\n\n\t //\n // 4. Sort the extracted lines by their length (shortest to longest)\n importLines.sort((a, b) => a.length - b.length);\n\t\n\t //\n // 5. Apply the changes back to the document\n // We use editor.edit() to batch all changes into a single undo/redo action\n editor\n .edit((editBuilder) => {\n for (let i = 0; i < importIndices.length; i++) {\n\t\t\t//\n const lineIndex = importIndices[i];\n const lineRange = document.lineAt(lineIndex).range;\n\n\t\t\t//\n // Replace the original line with the sorted line\n editBuilder.replace(lineRange, importLines[i]);\n }\n })\n .then((success) => {\n if (success) {\n\t\t\t//\n vscode.window.showInformationMessage(\n `Successfully sorted ${importLines.length} imports/usings by length!`,\n );\n }\n });\n },\n );\n\n //\n // 6. Push the disposable to the context's subscriptions\n // so it gets cleaned up when the extension is deactivated\n context.subscriptions.push(disposable);\n}\n\n//\nexport function deactivate() {}\n","module.exports = require(\"vscode\");","// The module cache\nconst __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tconst cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tconst module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nlet __webpack_exports__ = __webpack_require__(265);\n"],"names":["exports","activate","context","disposable","vscode","commands","registerCommand","editor","window","activeTextEditor","showWarningMessage","document","lines","getText","split","importLines","importIndices","i","length","trimmedLine","trim","isImportOrUsing","startsWith","isNotComment","push","sort","a","b","edit","editBuilder","lineIndex","lineRange","lineAt","range","replace","then","success","showInformationMessage","subscriptions","deactivate","__importStar","__webpack_require__","module","require","__webpack_module_cache__","__webpack_exports__","moduleId","cachedModule","undefined","__webpack_modules__","call"],"sourceRoot":""} \ No newline at end of file diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..7c51b0c --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,27 @@ +import typescriptEslint from "typescript-eslint"; + +export default [{ + files: ["**/*.ts"], +}, { + plugins: { + "@typescript-eslint": typescriptEslint.plugin, + }, + + languageOptions: { + parser: typescriptEslint.parser, + ecmaVersion: 2022, + sourceType: "module", + }, + + rules: { + "@typescript-eslint/naming-convention": ["warn", { + selector: "import", + format: ["camelCase", "PascalCase"], + }], + + curly: "warn", + eqeqeq: "warn", + "no-throw-literal": "warn", + semi: "warn", + }, +}]; \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..62384b0 --- /dev/null +++ b/package.json @@ -0,0 +1,59 @@ +{ + "name": "x-sort-impuses", + "displayName": "x-sort-impuses", + "description": "an Extension to Sort Import(s) / Using(s) ", + "version": "0.0.1", + "engines": { + "vscode": "^1.136.0" + }, + "categories": [ + "Other" + ], + "activationEvents": [], + "main": "./dist/extension.js", + "contributes": { + "commands": [ + { + "command": "x-sort-impuses.sortUsingsAndImports", + "title": "Sort Import(s)/Using(s) ..." + } + ], + "menus": { + "editor/context": [ + { + "when": "editorTextFocus", + "command": "x-sort-impuses.sortUsingsAndImports", + "group": "1_modification" + } + ] + } + }, + "scripts": { + "vscode:prepublish": "npm run package", + "compile": "webpack", + "watch": "webpack --watch", + "package": "webpack --mode production --devtool hidden-source-map", + "compile-tests": "tsc -p . --outDir out", + "watch-tests": "tsc -p . -w --outDir out", + "pretest": "npm run compile-tests && npm run compile && npm run lint", + "lint": "eslint src", + "test": "vscode-test" + }, + "devDependencies": { + "@types/vscode": "^1.136.0", + "@types/mocha": "^10.0.10", + "@types/node": "24.x", + "typescript-eslint": "^8.61.1", + "eslint": "^10.5.0", + "typescript": "^6.0.3", + "ts-loader": "^9.6.2", + "webpack": "^5.107.2", + "webpack-cli": "^7.0.3", + "@vscode/test-cli": "^0.0.15", + "@vscode/test-electron": "^3.0.0" + }, + "overrides": { + "diff": "^8.0.4", + "serialize-javascript": "^7.0.6" + } +} diff --git a/src/extension.ts b/src/extension.ts new file mode 100644 index 0000000..a42218f --- /dev/null +++ b/src/extension.ts @@ -0,0 +1,100 @@ +import * as vscode from "vscode"; + +// +export function activate(context: vscode.ExtensionContext) { + // + // 1. Register the command that will be triggered by the user + let disposable = vscode.commands.registerCommand( + "x-sort-impuses.sortUsingsAndImports", + () => { + // + // 2. Get the active text editor + const editor = vscode.window.activeTextEditor; + if (!editor) { + vscode.window.showWarningMessage("No active editor found."); + return; + } + + // + const document = editor.document; + const text = document.getText(); + + // + // Split text into lines (handling both Windows \r\n and Linux/Mac \n) + const lines = text.split(/\r?\n/); + + // + const importLines: string[] = []; + const importIndices: number[] = []; + + // + // 3. Identify all 'using' and 'import' lines + for (let i = 0; i < lines.length; i++) { + // + const trimmedLine = lines[i].trim(); + + // + // Check if the line starts with 'using ' or 'import ' + // We also ensure it's not a comment + const isImportOrUsing = + trimmedLine.startsWith("using ") || trimmedLine.startsWith("import "); + const isNotComment = + !trimmedLine.startsWith("//") && + !trimmedLine.startsWith("/*") && + !trimmedLine.startsWith("*"); + + // + if (isImportOrUsing && isNotComment) { + // + importLines.push(lines[i]); // Store the original line (with its indentation) + importIndices.push(i); // Store its line number + } + } + + // + if (importLines.length === 0) { + // + vscode.window.showInformationMessage( + "No usings or imports found in this file.", + ); + return; + } + + // + // 4. Sort the extracted lines by their length (shortest to longest) + importLines.sort((a, b) => a.length - b.length); + + // + // 5. Apply the changes back to the document + // We use editor.edit() to batch all changes into a single undo/redo action + editor + .edit((editBuilder) => { + for (let i = 0; i < importIndices.length; i++) { + // + const lineIndex = importIndices[i]; + const lineRange = document.lineAt(lineIndex).range; + + // + // Replace the original line with the sorted line + editBuilder.replace(lineRange, importLines[i]); + } + }) + .then((success) => { + if (success) { + // + vscode.window.showInformationMessage( + `Successfully sorted ${importLines.length} imports/usings by length!`, + ); + } + }); + }, + ); + + // + // 6. Push the disposable to the context's subscriptions + // so it gets cleaned up when the extension is deactivated + context.subscriptions.push(disposable); +} + +// +export function deactivate() {} diff --git a/src/test/extension.test.ts b/src/test/extension.test.ts new file mode 100644 index 0000000..4ca0ab4 --- /dev/null +++ b/src/test/extension.test.ts @@ -0,0 +1,15 @@ +import * as assert from 'assert'; + +// You can import and use all API from the 'vscode' module +// as well as import your extension to test it +import * as vscode from 'vscode'; +// import * as myExtension from '../../extension'; + +suite('Extension Test Suite', () => { + vscode.window.showInformationMessage('Start all tests.'); + + test('Sample test', () => { + assert.strictEqual(-1, [1, 2, 3].indexOf(5)); + assert.strictEqual(-1, [1, 2, 3].indexOf(0)); + }); +}); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..23cddf6 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "Node16", + "target": "ES2022", + "lib": [ + "ES2022" + ], + "types": [ + "node", + "mocha" + ], + "sourceMap": true, + "rootDir": "src", + "strict": true, /* enable all strict type-checking options */ + /* Additional Checks */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + } +} diff --git a/vsc-extension-quickstart.md b/vsc-extension-quickstart.md new file mode 100644 index 0000000..f518bb8 --- /dev/null +++ b/vsc-extension-quickstart.md @@ -0,0 +1,48 @@ +# Welcome to your VS Code Extension + +## What's in the folder + +* This folder contains all of the files necessary for your extension. +* `package.json` - this is the manifest file in which you declare your extension and command. + * The sample plugin registers a command and defines its title and command name. With this information VS Code can show the command in the command palette. It doesn’t yet need to load the plugin. +* `src/extension.ts` - this is the main file where you will provide the implementation of your command. + * The file exports one function, `activate`, which is called the very first time your extension is activated (in this case by executing the command). Inside the `activate` function we call `registerCommand`. + * We pass the function containing the implementation of the command as the second parameter to `registerCommand`. + +## Setup + +* install the recommended extensions (amodio.tsl-problem-matcher, ms-vscode.extension-test-runner, and dbaeumer.vscode-eslint) + + +## Get up and running straight away + +* Press `F5` to open a new window with your extension loaded. +* Run your command from the command palette by pressing (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and typing `Hello World`. +* Set breakpoints in your code inside `src/extension.ts` to debug your extension. +* Find output from your extension in the debug console. + +## Make changes + +* You can relaunch the extension from the debug toolbar after changing code in `src/extension.ts`. +* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes. + + +## Explore the API + +* You can open the full set of our API when you open the file `node_modules/@types/vscode/index.d.ts`. + +## Run tests + +* Install the [Extension Test Runner](https://marketplace.visualstudio.com/items?itemName=ms-vscode.extension-test-runner) +* Run the "watch" task via the **Tasks: Run Task** command. Make sure this is running, or tests might not be discovered. +* Open the Testing view from the activity bar and click the Run Test" button, or use the hotkey `Ctrl/Cmd + ; A` +* See the output of the test result in the Test Results view. +* Make changes to `src/test/extension.test.ts` or create new test files inside the `test` folder. + * The provided test runner will only consider files matching the name pattern `**.test.ts`. + * You can create folders inside the `test` folder to structure your tests any way you want. + +## Go further + +* Reduce the extension size and improve the startup time by [bundling your extension](https://code.visualstudio.com/api/working-with-extensions/bundling-extension). +* [Publish your extension](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) on the VS Code extension marketplace. +* Automate builds by setting up [Continuous Integration](https://code.visualstudio.com/api/working-with-extensions/continuous-integration). diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..37d7024 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,48 @@ +//@ts-check + +'use strict'; + +const path = require('path'); + +//@ts-check +/** @typedef {import('webpack').Configuration} WebpackConfig **/ + +/** @type WebpackConfig */ +const extensionConfig = { + target: 'node', // VS Code extensions run in a Node.js-context πŸ“– -> https://webpack.js.org/configuration/node/ + mode: 'none', // this leaves the source code as close as possible to the original (when packaging we set this to 'production') + + entry: './src/extension.ts', // the entry point of this extension, πŸ“– -> https://webpack.js.org/configuration/entry-context/ + output: { + // the bundle is stored in the 'dist' folder (check package.json), πŸ“– -> https://webpack.js.org/configuration/output/ + path: path.resolve(__dirname, 'dist'), + filename: 'extension.js', + libraryTarget: 'commonjs2' + }, + externals: { + vscode: 'commonjs vscode' // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, πŸ“– -> https://webpack.js.org/configuration/externals/ + // modules added here also need to be added in the .vscodeignore file + }, + resolve: { + // support reading TypeScript and JavaScript files, πŸ“– -> https://github.com/TypeStrong/ts-loader + extensions: ['.ts', '.js'] + }, + module: { + rules: [ + { + test: /\.ts$/, + exclude: /node_modules/, + use: [ + { + loader: 'ts-loader' + } + ] + } + ] + }, + devtool: 'nosources-source-map', + infrastructureLogging: { + level: "log", // enables logging required for problem matchers + }, +}; +module.exports = [ extensionConfig ]; \ No newline at end of file diff --git a/x-sort-impuses.code-workspace b/x-sort-impuses.code-workspace new file mode 100644 index 0000000..403f2d5 --- /dev/null +++ b/x-sort-impuses.code-workspace @@ -0,0 +1,10 @@ +{ + "folders": [ + { + "path": "." + } + ], + "settings": { + "js/ts.tsc.autoDetect": "off" + } +} \ No newline at end of file