read.cash Log in
a@amani2765 more from that month

vscode extension package update 1. Modify package.json: Open the package.json file. Add a commands section to define your command: JSON {  "name": "auto-import-shared-module",  "displayName": "Auto Import Shared Module",  "description": "Auto imports a shared module into all relevant files.",  "version": "0.0.1",  "engines": {  "vscode": "^1.75.0"  },  "categories": [  "Other"  ],  "activationEvents": [  "onCommand:extension.autoImportSharedModule"  ],  "main": "./out/extension.js",  "contributes": {  "commands": [  {  "command": "extension.autoImportSharedModule",  "title": "Auto Import Shared Module"  }  ]  },  "scripts": {  "vscode:prepublish": "npm run compile",  "compile": "tsc -p ./",  "watch": "tsc -watch -p ./",  "pretest": "npm run compile && npm run lint",  "lint": "eslint src --ext ts",  "test": "node ./out/test/runTest.js"  },  "devDependencies": {  "@types/node": "18.x",  "@types/vscode": "^1.75.0",  "@typescript-eslint/eslint-plugin": "^5.27.0",  "@typescript-eslint/parser": "^5.27.0",  "eslint": "^8.16.0",  "typescript": "^4.7.2",  "@vscode/test-electron": "^2.1.3"  } } 2. Compile and Run the Extension: Open the integrated terminal in VS Code (View > Terminal). Run npm install to install dependencies. Run npm run compile to compile the typescript code into javascript. Press F5 to start debugging the extension. This will open a new VS Code window (the Extension Development Host). 3. Test the Extension: In the Extension Development Host window, open a project that contains TypeScript files. Open the command palette (Ctrl+Shift+P or Cmd+Shift+P). Type "Auto Import Shared Module" and select your command. The extension should run, and you should see the import statements added to your files.

1 comment

Log in to join in Reading is open to everyone. Replying needs an account.