├── .vscodeignore ├── src └── extension.ts ├── README.mkd ├── tsconfig.json ├── package.json ├── webpack.config.js └── .gitignore /.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | out/** 4 | node_modules/** 5 | src/** 6 | .gitignore 7 | .yarnrc 8 | vsc-extension-quickstart.md 9 | **/tsconfig.json 10 | **/.eslintrc.json 11 | **/*.map 12 | **/*.ts 13 | -------------------------------------------------------------------------------- /src/extension.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode' 2 | 3 | export function activate(context: vscode.ExtensionContext) { 4 | const disposable = vscode.commands.registerCommand('vs-code-extensions-basic.hello', () => { 5 | vscode.window.showInformationMessage('hello') 6 | }) 7 | 8 | context.subscriptions.push(disposable) 9 | } 10 | 11 | export function deactivate() {} 12 | -------------------------------------------------------------------------------- /README.mkd: -------------------------------------------------------------------------------- 1 | ## **Basic typescript for developping vs code extension** 2 | 3 | You just need to run 4 | 5 | ```console 6 | npm install 7 | ``` 8 | 9 | For dev purposes: 10 | 11 | ```console 12 | npm run dev 13 | ``` 14 | 15 | To test it in dev mode you need to go to `extension.ts` press F5, use `vs-code dev` 16 | 17 | Then a new window appear, you will need to run the command (`CMD+Shift+P` or `CRTL+Shift+P`) and enter your command (basically `hello`) 18 | 19 | For Prod purposes: 20 | 21 | ```console 22 | npm run compile 23 | ``` 24 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "ES2020", 5 | "lib": [ 6 | "ES2020" 7 | ], 8 | "rootDir": "src", 9 | "strict": true /* enable all strict type-checking options */ 10 | /* Additional Checks */ 11 | // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ 12 | // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ 13 | // "noUnusedParameters": true, /* Report errors on unused parameters. */ 14 | }, 15 | "exclude": [ 16 | "node_modules", 17 | ".vscode-test" 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vs-code-extensions-basic", 3 | "displayName": "vs-code-extensions-basic", 4 | "version": "1.0.0", 5 | "description": "", 6 | "main": "./dist/extension.js", 7 | "engines": { 8 | "vscode": "^1.60.0" 9 | }, 10 | "keywords": [], 11 | "author": "Code-Oz", 12 | "license": "ISC", 13 | "categories": [ 14 | "Other" 15 | ], 16 | "activationEvents": [ 17 | "onCommand:vs-code-extensions-basic.hello" 18 | ], 19 | "contributes": { 20 | "commands": [ 21 | { 22 | "command": "vs-code-extensions-basic.hello", 23 | "title": "hello" 24 | } 25 | ] 26 | }, 27 | "scripts": { 28 | "compile": "cross-env --env.NODE_ENV=production webpack", 29 | "dev": "cross-env --env.NODE_ENV=dev webpack --watch" 30 | }, 31 | "dependencies": { 32 | "webpack": "^5.47.1" 33 | }, 34 | "devDependencies": { 35 | "@types/vscode": "^1.60.0", 36 | "cross-env": "^7.0.3", 37 | "ts-loader": "^9.2.5", 38 | "typescript": "^4.4.3", 39 | "webpack-cli": "^4.7.2" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path") 2 | const env = process.env.NODE_ENV 3 | 4 | const config = { 5 | target: 'node', 6 | mode: env === "dev" ? "development" : "production", 7 | devtool: env === "dev" ? "nosources-source-map" : "eval-cheap-source-map", 8 | entry: { 9 | myApp: [ 10 | "./src/extension.ts", 11 | ], 12 | }, 13 | output: { 14 | path: path.resolve(__dirname, "dist/"), 15 | filename: "extension.js", 16 | libraryTarget: 'commonjs2' 17 | }, 18 | externals: { 19 | 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/ 20 | // modules added here also need to be added in the .vsceignore file 21 | }, 22 | resolve: { 23 | extensions: ['.ts', '.js'] 24 | }, 25 | module: { 26 | rules: [ 27 | { 28 | test: /\.ts$/, 29 | exclude: /node_modules/, 30 | use: [ 31 | { 32 | loader: 'ts-loader' 33 | } 34 | ] 35 | } 36 | ] 37 | }, 38 | } 39 | 40 | module.exports = config 41 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig 2 | 3 | # Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode,macos,node,vs 4 | # Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode,macos,node,vs 5 | 6 | ### macOS ### 7 | # General 8 | .DS_Store 9 | .AppleDouble 10 | .LSOverride 11 | 12 | # Icon must end with two \r 13 | Icon 14 | 15 | # Thumbnails 16 | ._* 17 | 18 | # Files that might appear in the root of a volume 19 | .DocumentRevisions-V100 20 | .fseventsd 21 | .Spotlight-V100 22 | .TemporaryItems 23 | .Trashes 24 | .VolumeIcon.icns 25 | .com.apple.timemachine.donotpresent 26 | 27 | # Directories potentially created on remote AFP share 28 | .AppleDB 29 | .AppleDesktop 30 | Network Trash Folder 31 | Temporary Items 32 | .apdisk 33 | 34 | ### Node ### 35 | # Logs 36 | logs 37 | *.log 38 | npm-debug.log* 39 | yarn-debug.log* 40 | yarn-error.log* 41 | lerna-debug.log* 42 | .pnpm-debug.log* 43 | 44 | # Diagnostic reports (https://nodejs.org/api/report.html) 45 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 46 | 47 | # Runtime data 48 | pids 49 | *.pid 50 | *.seed 51 | *.pid.lock 52 | 53 | # Directory for instrumented libs generated by jscoverage/JSCover 54 | lib-cov 55 | 56 | # Coverage directory used by tools like istanbul 57 | coverage 58 | *.lcov 59 | 60 | # nyc test coverage 61 | .nyc_output 62 | 63 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 64 | .grunt 65 | 66 | # Bower dependency directory (https://bower.io/) 67 | bower_components 68 | 69 | # node-waf configuration 70 | .lock-wscript 71 | 72 | # Compiled binary addons (https://nodejs.org/api/addons.html) 73 | build/Release 74 | 75 | # Dependency directories 76 | node_modules/ 77 | jspm_packages/ 78 | 79 | # Snowpack dependency directory (https://snowpack.dev/) 80 | web_modules/ 81 | 82 | # TypeScript cache 83 | *.tsbuildinfo 84 | 85 | # Optional npm cache directory 86 | .npm 87 | 88 | # Optional eslint cache 89 | .eslintcache 90 | 91 | # Microbundle cache 92 | .rpt2_cache/ 93 | .rts2_cache_cjs/ 94 | .rts2_cache_es/ 95 | .rts2_cache_umd/ 96 | 97 | # Optional REPL history 98 | .node_repl_history 99 | 100 | # Output of 'npm pack' 101 | *.tgz 102 | 103 | # Yarn Integrity file 104 | .yarn-integrity 105 | 106 | # dotenv environment variables file 107 | .env 108 | .env.test 109 | .env.production 110 | 111 | # parcel-bundler cache (https://parceljs.org/) 112 | .cache 113 | .parcel-cache 114 | 115 | # Next.js build output 116 | .next 117 | out 118 | 119 | # Nuxt.js build / generate output 120 | .nuxt 121 | dist 122 | 123 | # Gatsby files 124 | .cache/ 125 | # Comment in the public line in if your project uses Gatsby and not Next.js 126 | # https://nextjs.org/blog/next-9-1#public-directory-support 127 | # public 128 | 129 | # vuepress build output 130 | .vuepress/dist 131 | 132 | # Serverless directories 133 | .serverless/ 134 | 135 | # FuseBox cache 136 | .fusebox/ 137 | 138 | # DynamoDB Local files 139 | .dynamodb/ 140 | 141 | # TernJS port file 142 | .tern-port 143 | 144 | # Stores VSCode versions used for testing VSCode extensions 145 | .vscode-test 146 | 147 | # yarn v2 148 | .yarn/cache 149 | .yarn/unplugged 150 | .yarn/build-state.yml 151 | .yarn/install-state.gz 152 | .pnp.* 153 | 154 | ### VisualStudioCode ### 155 | .vscode/* 156 | !.vscode/settings.json 157 | !.vscode/tasks.json 158 | !.vscode/launch.json 159 | !.vscode/extensions.json 160 | *.code-workspace 161 | 162 | # Local History for Visual Studio Code 163 | .history/ 164 | 165 | ### VisualStudioCode Patch ### 166 | # Ignore all local history of files 167 | .history 168 | .ionide 169 | 170 | ### vs ### 171 | ## Ignore Visual Studio temporary files, build results, and 172 | ## files generated by popular Visual Studio add-ons. 173 | ## 174 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 175 | 176 | # User-specific files 177 | *.rsuser 178 | *.suo 179 | *.user 180 | *.userosscache 181 | *.sln.docstates 182 | 183 | # User-specific files (MonoDevelop/Xamarin Studio) 184 | *.userprefs 185 | 186 | # Mono auto generated files 187 | mono_crash.* 188 | 189 | # Build results 190 | [Dd]ebug/ 191 | [Dd]ebugPublic/ 192 | [Rr]elease/ 193 | [Rr]eleases/ 194 | x64/ 195 | x86/ 196 | [Aa][Rr][Mm]/ 197 | [Aa][Rr][Mm]64/ 198 | bld/ 199 | [Bb]in/ 200 | [Oo]bj/ 201 | [Ll]og/ 202 | [Ll]ogs/ 203 | 204 | # Visual Studio 2015/2017 cache/options directory 205 | .vs/ 206 | # Uncomment if you have tasks that create the project's static files in wwwroot 207 | #wwwroot/ 208 | 209 | # Visual Studio 2017 auto generated files 210 | Generated\ Files/ 211 | 212 | # MSTest test Results 213 | [Tt]est[Rr]esult*/ 214 | [Bb]uild[Ll]og.* 215 | 216 | # NUnit 217 | *.VisualState.xml 218 | TestResult.xml 219 | nunit-*.xml 220 | 221 | # Build Results of an ATL Project 222 | [Dd]ebugPS/ 223 | [Rr]eleasePS/ 224 | dlldata.c 225 | 226 | # Benchmark Results 227 | BenchmarkDotNet.Artifacts/ 228 | 229 | # .NET Core 230 | project.lock.json 231 | project.fragment.lock.json 232 | artifacts/ 233 | 234 | # StyleCop 235 | StyleCopReport.xml 236 | 237 | # Files built by Visual Studio 238 | *_i.c 239 | *_p.c 240 | *_h.h 241 | *.ilk 242 | *.meta 243 | *.obj 244 | *.iobj 245 | *.pch 246 | *.pdb 247 | *.ipdb 248 | *.pgc 249 | *.pgd 250 | *.rsp 251 | *.sbr 252 | *.tlb 253 | *.tli 254 | *.tlh 255 | *.tmp 256 | *.tmp_proj 257 | *_wpftmp.csproj 258 | *.vspscc 259 | *.vssscc 260 | .builds 261 | *.pidb 262 | *.svclog 263 | *.scc 264 | 265 | # Chutzpah Test files 266 | _Chutzpah* 267 | 268 | # Visual C++ cache files 269 | ipch/ 270 | *.aps 271 | *.ncb 272 | *.opendb 273 | *.opensdf 274 | *.sdf 275 | *.cachefile 276 | *.VC.db 277 | *.VC.VC.opendb 278 | 279 | # Visual Studio profiler 280 | *.psess 281 | *.vsp 282 | *.vspx 283 | *.sap 284 | 285 | # Visual Studio Trace Files 286 | *.e2e 287 | 288 | # TFS 2012 Local Workspace 289 | $tf/ 290 | 291 | # Guidance Automation Toolkit 292 | *.gpState 293 | 294 | # ReSharper is a .NET coding add-in 295 | _ReSharper*/ 296 | *.[Rr]e[Ss]harper 297 | *.DotSettings.user 298 | 299 | # TeamCity is a build add-in 300 | _TeamCity* 301 | 302 | # DotCover is a Code Coverage Tool 303 | *.dotCover 304 | 305 | # AxoCover is a Code Coverage Tool 306 | .axoCover/* 307 | !.axoCover/settings.json 308 | 309 | # Coverlet is a free, cross platform Code Coverage Tool 310 | coverage*[.json, .xml, .info] 311 | 312 | # Visual Studio code coverage results 313 | *.coverage 314 | *.coveragexml 315 | 316 | # NCrunch 317 | _NCrunch_* 318 | .*crunch*.local.xml 319 | nCrunchTemp_* 320 | 321 | # MightyMoose 322 | *.mm.* 323 | AutoTest.Net/ 324 | 325 | # Web workbench (sass) 326 | .sass-cache/ 327 | 328 | # Installshield output folder 329 | [Ee]xpress/ 330 | 331 | # DocProject is a documentation generator add-in 332 | DocProject/buildhelp/ 333 | DocProject/Help/*.HxT 334 | DocProject/Help/*.HxC 335 | DocProject/Help/*.hhc 336 | DocProject/Help/*.hhk 337 | DocProject/Help/*.hhp 338 | DocProject/Help/Html2 339 | DocProject/Help/html 340 | 341 | # Click-Once directory 342 | publish/ 343 | 344 | # Publish Web Output 345 | *.[Pp]ublish.xml 346 | *.azurePubxml 347 | # Note: Comment the next line if you want to checkin your web deploy settings, 348 | # but database connection strings (with potential passwords) will be unencrypted 349 | *.pubxml 350 | *.publishproj 351 | 352 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 353 | # checkin your Azure Web App publish settings, but sensitive information contained 354 | # in these scripts will be unencrypted 355 | PublishScripts/ 356 | 357 | # NuGet Packages 358 | *.nupkg 359 | # NuGet Symbol Packages 360 | *.snupkg 361 | # The packages folder can be ignored because of Package Restore 362 | **/[Pp]ackages/* 363 | # except build/, which is used as an MSBuild target. 364 | !**/[Pp]ackages/build/ 365 | # Uncomment if necessary however generally it will be regenerated when needed 366 | #!**/[Pp]ackages/repositories.config 367 | # NuGet v3's project.json files produces more ignorable files 368 | *.nuget.props 369 | *.nuget.targets 370 | 371 | # Microsoft Azure Build Output 372 | csx/ 373 | *.build.csdef 374 | 375 | # Microsoft Azure Emulator 376 | ecf/ 377 | rcf/ 378 | 379 | # Windows Store app package directories and files 380 | AppPackages/ 381 | BundleArtifacts/ 382 | Package.StoreAssociation.xml 383 | _pkginfo.txt 384 | *.appx 385 | *.appxbundle 386 | *.appxupload 387 | 388 | # Visual Studio cache files 389 | # files ending in .cache can be ignored 390 | *.[Cc]ache 391 | # but keep track of directories ending in .cache 392 | !?*.[Cc]ache/ 393 | 394 | # Others 395 | ClientBin/ 396 | ~$* 397 | *~ 398 | *.dbmdl 399 | *.dbproj.schemaview 400 | *.jfm 401 | *.pfx 402 | *.publishsettings 403 | orleans.codegen.cs 404 | 405 | # Including strong name files can present a security risk 406 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 407 | #*.snk 408 | 409 | # Since there are multiple workflows, uncomment next line to ignore bower_components 410 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 411 | #bower_components/ 412 | 413 | # RIA/Silverlight projects 414 | Generated_Code/ 415 | 416 | # Backup & report files from converting an old project file 417 | # to a newer Visual Studio version. Backup files are not needed, 418 | # because we have git ;-) 419 | _UpgradeReport_Files/ 420 | Backup*/ 421 | UpgradeLog*.XML 422 | UpgradeLog*.htm 423 | ServiceFabricBackup/ 424 | *.rptproj.bak 425 | 426 | # SQL Server files 427 | *.mdf 428 | *.ldf 429 | *.ndf 430 | 431 | # Business Intelligence projects 432 | *.rdl.data 433 | *.bim.layout 434 | *.bim_*.settings 435 | *.rptproj.rsuser 436 | *- [Bb]ackup.rdl 437 | *- [Bb]ackup ([0-9]).rdl 438 | *- [Bb]ackup ([0-9][0-9]).rdl 439 | 440 | # Microsoft Fakes 441 | FakesAssemblies/ 442 | 443 | # GhostDoc plugin setting file 444 | *.GhostDoc.xml 445 | 446 | # Node.js Tools for Visual Studio 447 | .ntvs_analysis.dat 448 | 449 | # Visual Studio 6 build log 450 | *.plg 451 | 452 | # Visual Studio 6 workspace options file 453 | *.opt 454 | 455 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 456 | *.vbw 457 | 458 | # Visual Studio LightSwitch build output 459 | **/*.HTMLClient/GeneratedArtifacts 460 | **/*.DesktopClient/GeneratedArtifacts 461 | **/*.DesktopClient/ModelManifest.xml 462 | **/*.Server/GeneratedArtifacts 463 | **/*.Server/ModelManifest.xml 464 | _Pvt_Extensions 465 | 466 | # Paket dependency manager 467 | .paket/paket.exe 468 | paket-files/ 469 | 470 | # FAKE - F# Make 471 | .fake/ 472 | 473 | # CodeRush personal settings 474 | .cr/personal 475 | 476 | # Python Tools for Visual Studio (PTVS) 477 | __pycache__/ 478 | *.pyc 479 | 480 | # Cake - Uncomment if you are using it 481 | # tools/** 482 | # !tools/packages.config 483 | 484 | # Tabs Studio 485 | *.tss 486 | 487 | # Telerik's JustMock configuration file 488 | *.jmconfig 489 | 490 | # BizTalk build output 491 | *.btp.cs 492 | *.btm.cs 493 | *.odx.cs 494 | *.xsd.cs 495 | 496 | # OpenCover UI analysis results 497 | OpenCover/ 498 | 499 | # Azure Stream Analytics local run output 500 | ASALocalRun/ 501 | 502 | # MSBuild Binary and Structured Log 503 | *.binlog 504 | 505 | # NVidia Nsight GPU debugger configuration file 506 | *.nvuser 507 | 508 | # MFractors (Xamarin productivity tool) working folder 509 | .mfractor/ 510 | 511 | # Local History for Visual Studio 512 | .localhistory/ 513 | 514 | # BeatPulse healthcheck temp database 515 | healthchecksdb 516 | 517 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 518 | MigrationBackup/ 519 | 520 | # Ionide (cross platform F# VS Code tools) working folder 521 | .ionide/ 522 | 523 | # End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,macos,node,vs 524 | 525 | # Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option) 526 | 527 | --------------------------------------------------------------------------------