コンテンツにスキップ

VSCode の拡張機能を作成する

Your First Extension | Visual Studio Code Extension API

1
$ npx --package yo --package generator-code -- yo code
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
D:\src>npx --package yo --package generator-code -- yo code

     _-----_     ╭──────────────────────────╮
    |       |       Welcome to the Visual      |--(o)--|       Studio Code Extension     `---------´           generator!            ( _´U`_ )    ╰──────────────────────────╯
    /___A___\   /
     |  ~  |
   __'.___.'__
 ´   `  |° ´ Y `

? What type of extension do you want to create? New Extension (TypeScript)
? What's the name of your extension? vscode-extension
? What's the identifier of your extension? vscode-extension
? What's the description of your extension?
? Initialize a git repository? Yes
? Which bundler to use? unbundled
? Which package manager to use? npm

Writing in D:\src\vscode-extension...
   create vscode-extension\.vscode\extensions.json
   create vscode-extension\.vscode\launch.json
   create vscode-extension\.vscode\settings.json
   create vscode-extension\.vscode\tasks.json
   create vscode-extension\package.json
   create vscode-extension\tsconfig.json
   create vscode-extension\.vscodeignore
   create vscode-extension\vsc-extension-quickstart.md
   create vscode-extension\.gitignore
   create vscode-extension\README.md
   create vscode-extension\CHANGELOG.md
   create vscode-extension\src\extension.ts
   create vscode-extension\src\test\extension.test.ts
   create vscode-extension\.vscode-test.mjs
   create vscode-extension\eslint.config.mjs

Changes to package.json were detected.

Running npm install for you to install the required dependencies.
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported

added 261 packages, and audited 262 packages in 2s

74 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Your extension vscode-extension has been created!

To start editing with Visual Studio Code, use the following commands:

     code vscode-extension

Open vsc-extension-quickstart.md inside the new extension for further instructions
on how to modify, test and publish your extension.

For more information, also visit http://code.visualstudio.com and follow us @code.


? Do you want to open the new folder with Visual Studio Code? Open with `code`

src\extension.tsを開いた状態で F5 を押して Ctrl+Shift+P でHello Worldを実行する。