generator-code 1.8.6 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/generators/app/dependencyVersions/package.json +11 -8
- package/generators/app/generate-command-ts.js +11 -8
- package/generators/app/generate-command-web.js +18 -4
- package/generators/app/index.js +1 -1
- package/generators/app/prompts.js +33 -16
- package/generators/app/templates/ext-colortheme/vscode/launch.json +11 -11
- package/generators/app/templates/ext-command-js/vscode/extensions.json +1 -1
- package/generators/app/templates/ext-command-ts/vsc-extension-quickstart.md +3 -3
- package/generators/app/templates/ext-command-ts/vscode/extensions.json +1 -1
- package/generators/app/templates/ext-command-ts/vscode/settings.json +9 -9
- package/generators/app/templates/ext-command-ts/vscode-esbuild/.vscodeignore +14 -0
- package/generators/app/templates/ext-command-ts/vscode-esbuild/esbuild.js +56 -0
- package/generators/app/templates/ext-command-ts/vscode-esbuild/package.json +52 -0
- package/generators/app/templates/ext-command-ts/vscode-esbuild/tsconfig.json +16 -0
- package/generators/app/templates/ext-command-ts/vscode-esbuild/vsc-extension-quickstart.md +48 -0
- package/generators/app/templates/ext-command-ts/vscode-esbuild/vscode/extensions.json +5 -0
- package/generators/app/templates/ext-command-ts/vscode-esbuild/vscode/launch.json +21 -0
- package/generators/app/templates/ext-command-ts/vscode-esbuild/vscode/settings.json +13 -0
- package/generators/app/templates/ext-command-ts/vscode-esbuild/vscode/tasks.json +67 -0
- package/generators/app/templates/ext-command-ts/vscode-webpack/vscode/settings.json +11 -11
- package/generators/app/templates/ext-command-web/.vscodeignore +2 -0
- package/generators/app/templates/ext-command-web/esbuild-package.json +51 -0
- package/generators/app/templates/ext-command-web/esbuild.js +100 -0
- package/generators/app/templates/ext-command-web/src/web/test/suite/esbuild-mochaTestRunner.ts +26 -0
- package/generators/app/templates/ext-command-web/vscode-esbuild/extensions.json +9 -0
- package/generators/app/templates/ext-command-web/vscode-esbuild/launch.json +38 -0
- package/generators/app/templates/ext-command-web/vscode-esbuild/tasks.json +57 -0
- package/generators/app/templates/ext-command-web/vscode-webpack/extensions.json +8 -0
- package/generators/app/templates/ext-command-web/{vscode → vscode-webpack}/launch.json +3 -3
- package/generators/app/templates/ext-command-web/vscode-webpack/settings.json +11 -0
- package/generators/app/templates/ext-extensionpack/vscode/launch.json +11 -11
- package/generators/app/templates/ext-keymap/vscode/launch.json +11 -11
- package/generators/app/templates/ext-language/vscode/launch.json +11 -11
- package/generators/app/templates/ext-notebook-renderer/vscode/launch.json +31 -31
- package/generators/app/templates/ext-notebook-renderer/vscode/settings.json +8 -8
- package/generators/app/templates/ext-notebook-renderer/vscode/tasks.json +32 -32
- package/generators/app/templates/ext-snippets/vscode/launch.json +11 -11
- package/package.json +4 -4
- package/generators/app/templates/ext-command-web/vscode/extensions.json +0 -5
- /package/generators/app/templates/ext-command-web/src/web/test/suite/{index.ts → webpack-mochaTestRunner.ts} +0 -0
- /package/generators/app/templates/ext-command-web/{vscode → vscode-esbuild}/settings.json +0 -0
- /package/generators/app/templates/ext-command-web/{vscode → vscode-webpack}/tasks.json +0 -0
- /package/generators/app/templates/ext-command-web/{package.json → webpack-package.json} +0 -0
package/README.md
CHANGED
|
@@ -57,7 +57,7 @@ Options:
|
|
|
57
57
|
--extensionId # Id of the extension
|
|
58
58
|
--extensionDescription # Description of the extension
|
|
59
59
|
--pkgManager # 'npm', 'yarn' or 'pnpm'
|
|
60
|
-
--
|
|
60
|
+
--bundle # 'webpack', 'esbuild'. Bundle the extension with webpack or esbuild
|
|
61
61
|
--gitInit # Initialize a git repo
|
|
62
62
|
|
|
63
63
|
Example usages:
|
|
@@ -7,19 +7,19 @@
|
|
|
7
7
|
"@types/mocha": "^10.0.6",
|
|
8
8
|
"@types/node": "18.x",
|
|
9
9
|
"@types/assert": "^1.5.10",
|
|
10
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
11
|
-
"@typescript-eslint/parser": "^7.
|
|
10
|
+
"@typescript-eslint/eslint-plugin": "^7.11.0",
|
|
11
|
+
"@typescript-eslint/parser": "^7.11.0",
|
|
12
12
|
"eslint": "^8.57.0",
|
|
13
|
-
"glob": "^10.
|
|
13
|
+
"glob": "^10.4.1",
|
|
14
14
|
"mocha": "^10.4.0",
|
|
15
15
|
"typescript": "^5.4.5",
|
|
16
|
-
"@vscode/test-cli": "^0.0.
|
|
17
|
-
"@vscode/test-electron": "^2.
|
|
16
|
+
"@vscode/test-cli": "^0.0.9",
|
|
17
|
+
"@vscode/test-electron": "^2.4.0",
|
|
18
18
|
"@vscode/test-web": "^0.0.54",
|
|
19
|
-
"@types/webpack-env": "^1.18.
|
|
19
|
+
"@types/webpack-env": "^1.18.5",
|
|
20
20
|
"@types/vscode-notebook-renderer": "^1.72.3",
|
|
21
21
|
"concurrently": "^8.2.2",
|
|
22
|
-
"css-loader": "^7.1.
|
|
22
|
+
"css-loader": "^7.1.2",
|
|
23
23
|
"fork-ts-checker-webpack-plugin": "^9.0.2",
|
|
24
24
|
"style-loader": "^4.0.0",
|
|
25
25
|
"ts-loader": "^9.5.1",
|
|
@@ -30,6 +30,9 @@
|
|
|
30
30
|
"webpack-cli": "^5.1.4",
|
|
31
31
|
"webpack-dev-server": "^5.0.4",
|
|
32
32
|
"assert": "^2.1.0",
|
|
33
|
-
"process": "^0.11.10"
|
|
33
|
+
"process": "^0.11.10",
|
|
34
|
+
"npm-run-all": "^4.1.5",
|
|
35
|
+
"esbuild": "^0.21.4",
|
|
36
|
+
"@esbuild-plugins/node-globals-polyfill": "^0.2.3"
|
|
34
37
|
}
|
|
35
38
|
}
|
|
@@ -22,7 +22,7 @@ export default {
|
|
|
22
22
|
await prompts.askForExtensionDescription(generator, extensionConfig);
|
|
23
23
|
|
|
24
24
|
await prompts.askForGit(generator, extensionConfig);
|
|
25
|
-
await prompts.
|
|
25
|
+
await prompts.askForBundler(generator, extensionConfig);
|
|
26
26
|
await prompts.askForPackageManager(generator, extensionConfig);
|
|
27
27
|
},
|
|
28
28
|
/**
|
|
@@ -30,13 +30,16 @@ export default {
|
|
|
30
30
|
* @param {Object} extensionConfig
|
|
31
31
|
*/
|
|
32
32
|
writing: (generator, extensionConfig) => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
generator.fs.
|
|
38
|
-
generator.fs.copyTpl(generator.templatePath('
|
|
39
|
-
generator.fs.copyTpl(generator.templatePath('
|
|
33
|
+
const bundler = extensionConfig.bundler;
|
|
34
|
+
if (bundler && (bundler === 'webpack' || bundler === 'esbuild')) {
|
|
35
|
+
const bundlerPath = bundler === 'esbuild' ? 'vscode-esbuild' : 'vscode-webpack';
|
|
36
|
+
const bundlerFile = bundler === 'esbuild' ? 'esbuild.js' : 'webpack.config.js';
|
|
37
|
+
generator.fs.copy(generator.templatePath(bundlerPath, 'vscode'), generator.destinationPath('.vscode'));
|
|
38
|
+
generator.fs.copyTpl(generator.templatePath(bundlerPath, 'package.json'), generator.destinationPath('package.json'), extensionConfig);
|
|
39
|
+
generator.fs.copyTpl(generator.templatePath(bundlerPath, 'tsconfig.json'), generator.destinationPath('tsconfig.json'), extensionConfig);
|
|
40
|
+
generator.fs.copyTpl(generator.templatePath(bundlerPath, '.vscodeignore'), generator.destinationPath('.vscodeignore'), extensionConfig);
|
|
41
|
+
generator.fs.copyTpl(generator.templatePath(bundlerPath, bundlerFile), generator.destinationPath(bundlerFile), extensionConfig);
|
|
42
|
+
generator.fs.copyTpl(generator.templatePath(bundlerPath, 'vsc-extension-quickstart.md'), generator.destinationPath('vsc-extension-quickstart.md'), extensionConfig);
|
|
40
43
|
} else {
|
|
41
44
|
generator.fs.copy(generator.templatePath('vscode'), generator.destinationPath('.vscode'));
|
|
42
45
|
generator.fs.copyTpl(generator.templatePath('package.json'), generator.destinationPath('package.json'), extensionConfig);
|
|
@@ -21,6 +21,7 @@ export default {
|
|
|
21
21
|
await prompts.askForExtensionDescription(generator, extensionConfig);
|
|
22
22
|
|
|
23
23
|
await prompts.askForGit(generator, extensionConfig);
|
|
24
|
+
await prompts.askForBundler(generator, extensionConfig, false, 'webpack');
|
|
24
25
|
await prompts.askForPackageManager(generator, extensionConfig);
|
|
25
26
|
},
|
|
26
27
|
/**
|
|
@@ -28,8 +29,12 @@ export default {
|
|
|
28
29
|
* @param {Object} extensionConfig
|
|
29
30
|
*/
|
|
30
31
|
writing: (generator, extensionConfig) => {
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
const bundler = extensionConfig.bundler;
|
|
33
|
+
if (bundler === 'esbuild') {
|
|
34
|
+
generator.fs.copy(generator.templatePath('vscode-esbuild'), generator.destinationPath('.vscode'));
|
|
35
|
+
} else {
|
|
36
|
+
generator.fs.copy(generator.templatePath('vscode-webpack'), generator.destinationPath('.vscode'));
|
|
37
|
+
}
|
|
33
38
|
|
|
34
39
|
generator.fs.copy(generator.templatePath('.vscodeignore'), generator.destinationPath('.vscodeignore'));
|
|
35
40
|
if (extensionConfig.gitInit) {
|
|
@@ -42,8 +47,17 @@ export default {
|
|
|
42
47
|
|
|
43
48
|
generator.fs.copyTpl(generator.templatePath('src/web/extension.ts'), generator.destinationPath('src/web/extension.ts'), extensionConfig);
|
|
44
49
|
|
|
45
|
-
generator.fs.
|
|
46
|
-
|
|
50
|
+
generator.fs.copy(generator.templatePath('src/web/test/suite/extension.test.ts'), generator.destinationPath('src/web/test/suite/extension.test.ts'));
|
|
51
|
+
|
|
52
|
+
if (bundler === 'esbuild') {
|
|
53
|
+
generator.fs.copyTpl(generator.templatePath('esbuild.js'), generator.destinationPath('esbuild.js'), extensionConfig);
|
|
54
|
+
generator.fs.copyTpl(generator.templatePath('esbuild-package.json'), generator.destinationPath('package.json'), extensionConfig);
|
|
55
|
+
generator.fs.copy(generator.templatePath('src/web/test/suite/esbuild-mochaTestRunner.ts'), generator.destinationPath('src/web/test/suite/mochaTestRunner.ts'));
|
|
56
|
+
} else {
|
|
57
|
+
generator.fs.copyTpl(generator.templatePath('webpack.config.js'), generator.destinationPath('webpack.config.js'), extensionConfig);
|
|
58
|
+
generator.fs.copyTpl(generator.templatePath('webpack-package.json'), generator.destinationPath('package.json'), extensionConfig);
|
|
59
|
+
generator.fs.copy(generator.templatePath('src/web/test/suite/webpack-mochaTestRunner.ts'), generator.destinationPath('src/web/test/suite/index.ts'));
|
|
60
|
+
}
|
|
47
61
|
|
|
48
62
|
generator.fs.copy(generator.templatePath('.eslintrc.json'), generator.destinationPath('.eslintrc.json'));
|
|
49
63
|
|
package/generators/app/index.js
CHANGED
|
@@ -44,7 +44,7 @@ export default class extends Generator {
|
|
|
44
44
|
this.option('extensionDescription', { type: String, description: 'Description of the extension' });
|
|
45
45
|
|
|
46
46
|
this.option('pkgManager', { type: String, description: `'npm', 'yarn' or 'pnpm'` });
|
|
47
|
-
this.option('
|
|
47
|
+
this.option('bundler', { type: String, description: `Bundle the extension: 'webpack', 'esbuild'` });
|
|
48
48
|
this.option('gitInit', { type: Boolean, description: `Initialize a git repo` });
|
|
49
49
|
|
|
50
50
|
this.option('snippetFolder', { type: String, description: `Snippet folder location` });
|
|
@@ -41,7 +41,7 @@ export function askForExtensionDisplayName(generator, extensionConfig) {
|
|
|
41
41
|
* @param {Object} extensionConfig
|
|
42
42
|
*/
|
|
43
43
|
export function askForExtensionId(generator, extensionConfig) {
|
|
44
|
-
|
|
44
|
+
const extensionName = generator.options['extensionId'];
|
|
45
45
|
if (extensionName) {
|
|
46
46
|
extensionConfig.name = extensionName;
|
|
47
47
|
return Promise.resolve();
|
|
@@ -72,7 +72,7 @@ export function askForExtensionId(generator, extensionConfig) {
|
|
|
72
72
|
* @param {Object} extensionConfig
|
|
73
73
|
*/
|
|
74
74
|
export function askForExtensionDescription(generator, extensionConfig) {
|
|
75
|
-
|
|
75
|
+
const extensionDescription = generator.options['extensionDescription'];
|
|
76
76
|
if (extensionDescription) {
|
|
77
77
|
extensionConfig.description = extensionDescription;
|
|
78
78
|
return Promise.resolve();
|
|
@@ -97,7 +97,7 @@ export function askForExtensionDescription(generator, extensionConfig) {
|
|
|
97
97
|
* @param {Object} extensionConfig
|
|
98
98
|
*/
|
|
99
99
|
export function askForGit(generator, extensionConfig) {
|
|
100
|
-
|
|
100
|
+
const gitInit = generator.options['gitInit'];
|
|
101
101
|
if (typeof gitInit === 'boolean') {
|
|
102
102
|
extensionConfig.gitInit = Boolean(gitInit);
|
|
103
103
|
return Promise.resolve();
|
|
@@ -122,7 +122,7 @@ export function askForGit(generator, extensionConfig) {
|
|
|
122
122
|
* @param {Object} extensionConfig
|
|
123
123
|
*/
|
|
124
124
|
export function askForPackageManager(generator, extensionConfig) {
|
|
125
|
-
|
|
125
|
+
const pkgManager = generator.options['pkgManager'];
|
|
126
126
|
if (pkgManager === 'npm' || pkgManager === 'yarn' || pkgManager === 'pnpm') {
|
|
127
127
|
extensionConfig.pkgManager = pkgManager;
|
|
128
128
|
return Promise.resolve();
|
|
@@ -161,24 +161,41 @@ export function askForPackageManager(generator, extensionConfig) {
|
|
|
161
161
|
* @param {Generator} generator
|
|
162
162
|
* @param {Object} extensionConfig
|
|
163
163
|
*/
|
|
164
|
-
export function
|
|
165
|
-
|
|
166
|
-
if (
|
|
167
|
-
extensionConfig.
|
|
164
|
+
export function askForBundler(generator, extensionConfig, allowNone = true, defaultBundler = 'unbundled') {
|
|
165
|
+
const bundler = generator.options['bundler'];
|
|
166
|
+
if (bundler === 'webpack' || bundler === 'esbuild') {
|
|
167
|
+
extensionConfig.bundler = bundler;
|
|
168
|
+
return Promise.resolve();
|
|
169
|
+
}
|
|
170
|
+
const webpack = generator.options['webpack']; // backwards compatibility
|
|
171
|
+
if (typeof webpack === 'boolean' && webpack) {
|
|
172
|
+
extensionConfig.bundler = 'webpack';
|
|
168
173
|
return Promise.resolve();
|
|
169
174
|
}
|
|
170
|
-
|
|
171
175
|
if (generator.options['quick']) {
|
|
172
|
-
extensionConfig.
|
|
176
|
+
extensionConfig.bundler = defaultBundler;
|
|
173
177
|
return Promise.resolve();
|
|
174
178
|
}
|
|
175
179
|
|
|
180
|
+
const choices = allowNone ? [{ name: 'unbundled', value: 'unbundled' }] : [];
|
|
181
|
+
|
|
176
182
|
return generator.prompt({
|
|
177
|
-
type: '
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
+
type: 'list',
|
|
184
|
+
default: defaultBundler,
|
|
185
|
+
name: 'bundler',
|
|
186
|
+
message: 'Which bundler to use?',
|
|
187
|
+
choices: [
|
|
188
|
+
...choices,
|
|
189
|
+
{
|
|
190
|
+
name: 'webpack',
|
|
191
|
+
value: 'webpack'
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
name: 'esbuild',
|
|
195
|
+
value: 'esbuild'
|
|
196
|
+
}
|
|
197
|
+
]
|
|
198
|
+
}).then(bundlerAnswer => {
|
|
199
|
+
extensionConfig.bundler = bundlerAnswer.bundler;
|
|
183
200
|
});
|
|
184
201
|
}
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
5
|
{
|
|
6
6
|
"version": "0.2.0",
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
7
|
+
"configurations": [
|
|
8
|
+
{
|
|
9
|
+
"name": "Extension",
|
|
10
|
+
"type": "extensionHost",
|
|
11
|
+
"request": "launch",
|
|
12
|
+
"args": [
|
|
13
|
+
"--extensionDevelopmentPath=${workspaceFolder}"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
@@ -38,6 +38,6 @@
|
|
|
38
38
|
## Go further
|
|
39
39
|
|
|
40
40
|
* [Follow UX guidelines](https://code.visualstudio.com/api/ux-guidelines/overview) to create extensions that seamlessly integrate with VS Code's native interface and patterns.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
* Reduce the extension size and improve the startup time by [bundling your extension](https://code.visualstudio.com/api/working-with-extensions/bundling-extension).
|
|
42
|
+
* [Publish your extension](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) on the VS Code extension marketplace.
|
|
43
|
+
* Automate builds by setting up [Continuous Integration](https://code.visualstudio.com/api/working-with-extensions/continuous-integration).
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// Place your settings in this file to overwrite default and user settings.
|
|
2
2
|
{
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
3
|
+
"files.exclude": {
|
|
4
|
+
"out": false // set this to true to hide the "out" folder with the compiled JS files
|
|
5
|
+
},
|
|
6
|
+
"search.exclude": {
|
|
7
|
+
"out": true // set this to false to include "out" folder in search results
|
|
8
|
+
},
|
|
9
|
+
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
|
|
10
|
+
"typescript.tsc.autoDetect": "off"
|
|
11
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const esbuild = require("esbuild");
|
|
2
|
+
|
|
3
|
+
const production = process.argv.includes('--production');
|
|
4
|
+
const watch = process.argv.includes('--watch');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @type {import('esbuild').Plugin}
|
|
8
|
+
*/
|
|
9
|
+
const esbuildProblemMatcherPlugin = {
|
|
10
|
+
name: 'esbuild-problem-matcher',
|
|
11
|
+
|
|
12
|
+
setup(build) {
|
|
13
|
+
build.onStart(() => {
|
|
14
|
+
console.log('[watch] build started');
|
|
15
|
+
});
|
|
16
|
+
build.onEnd((result) => {
|
|
17
|
+
result.errors.forEach(({ text, location }) => {
|
|
18
|
+
console.error(`✘ [ERROR] ${text}`);
|
|
19
|
+
console.error(` ${location.file}:${location.line}:${location.column}:`);
|
|
20
|
+
});
|
|
21
|
+
console.log('[watch] build finished');
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
async function main() {
|
|
27
|
+
const ctx = await esbuild.context({
|
|
28
|
+
entryPoints: [
|
|
29
|
+
'src/extension.ts'
|
|
30
|
+
],
|
|
31
|
+
bundle: true,
|
|
32
|
+
format: 'cjs',
|
|
33
|
+
minify: production,
|
|
34
|
+
sourcemap: !production,
|
|
35
|
+
sourcesContent: false,
|
|
36
|
+
platform: 'node',
|
|
37
|
+
outfile: 'dist/extension.js',
|
|
38
|
+
external: ['vscode'],
|
|
39
|
+
logLevel: 'silent',
|
|
40
|
+
plugins: [
|
|
41
|
+
/* add to the end of plugins array */
|
|
42
|
+
esbuildProblemMatcherPlugin,
|
|
43
|
+
],
|
|
44
|
+
});
|
|
45
|
+
if (watch) {
|
|
46
|
+
await ctx.watch();
|
|
47
|
+
} else {
|
|
48
|
+
await ctx.rebuild();
|
|
49
|
+
await ctx.dispose();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
main().catch(e => {
|
|
54
|
+
console.error(e);
|
|
55
|
+
process.exit(1);
|
|
56
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": <%- JSON.stringify(name) %>,
|
|
3
|
+
"displayName": <%- JSON.stringify(displayName) %>,
|
|
4
|
+
"description": <%- JSON.stringify(description) %>,
|
|
5
|
+
"version": "0.0.1",
|
|
6
|
+
"engines": {
|
|
7
|
+
"vscode": <%- JSON.stringify(vsCodeEngine) %>
|
|
8
|
+
},
|
|
9
|
+
"categories": [
|
|
10
|
+
"Other"
|
|
11
|
+
],
|
|
12
|
+
"activationEvents": [],
|
|
13
|
+
"main": "./dist/extension.js",<% if (insiders) { %>
|
|
14
|
+
"enabledApiProposals": [],<% } %>
|
|
15
|
+
"contributes": {
|
|
16
|
+
"commands": [
|
|
17
|
+
{
|
|
18
|
+
"command": <%- JSON.stringify(`${name}.helloWorld`) %>,
|
|
19
|
+
"title": "Hello World"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"vscode:prepublish": "<%= pkgManager %> run package",
|
|
25
|
+
"compile": "<%= pkgManager %> run check-types && <%= pkgManager %> run lint && node esbuild.js",
|
|
26
|
+
"watch": "npm-run-all -p watch:*",
|
|
27
|
+
"watch:esbuild": "node esbuild.js --watch",
|
|
28
|
+
"watch:tsc": "tsc --noEmit --watch --project tsconfig.json",
|
|
29
|
+
"package": "<%= pkgManager %> run check-types && <%= pkgManager %> run lint && node esbuild.js --production",
|
|
30
|
+
"compile-tests": "tsc -p . --outDir out",
|
|
31
|
+
"watch-tests": "tsc -p . -w --outDir out",
|
|
32
|
+
"pretest": "<%= pkgManager %> run compile-tests && <%= pkgManager %> run compile && <%= pkgManager %> run lint",
|
|
33
|
+
"check-types": "tsc --noEmit",
|
|
34
|
+
"lint": "eslint src --ext ts",
|
|
35
|
+
"test": "vscode-test"<% if (insiders) { %>,
|
|
36
|
+
"update-proposed-api": "vscode-dts dev"<% } %>
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
<%- dep("@types/vscode") %>,
|
|
40
|
+
<%- dep("@types/mocha") %>,
|
|
41
|
+
<%- dep("@types/node") %>,
|
|
42
|
+
<%- dep("@typescript-eslint/eslint-plugin") %>,
|
|
43
|
+
<%- dep("@typescript-eslint/parser") %>,
|
|
44
|
+
<%- dep("eslint") %>,
|
|
45
|
+
<%- dep("esbuild") %>,
|
|
46
|
+
<%- dep("npm-run-all") %>,
|
|
47
|
+
<%- dep("typescript") %>,
|
|
48
|
+
<%- dep("@vscode/test-cli") %>,
|
|
49
|
+
<%- dep("@vscode/test-electron") %><% if (insiders) { %>,
|
|
50
|
+
<%- dep("vscode-dts") %><% } %>
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "Node16",
|
|
4
|
+
"target": "ES2022",
|
|
5
|
+
"lib": [
|
|
6
|
+
"ES2022"
|
|
7
|
+
],
|
|
8
|
+
"sourceMap": true,
|
|
9
|
+
"rootDir": "src",
|
|
10
|
+
"strict": true /* enable all strict type-checking options */
|
|
11
|
+
/* Additional Checks */
|
|
12
|
+
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
|
13
|
+
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
|
14
|
+
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Welcome to your VS Code Extension
|
|
2
|
+
|
|
3
|
+
## What's in the folder
|
|
4
|
+
|
|
5
|
+
* This folder contains all of the files necessary for your extension.
|
|
6
|
+
* `package.json` - this is the manifest file in which you declare your extension and command.
|
|
7
|
+
* 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.
|
|
8
|
+
* `src/extension.ts` - this is the main file where you will provide the implementation of your command.
|
|
9
|
+
* 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`.
|
|
10
|
+
* We pass the function containing the implementation of the command as the second parameter to `registerCommand`.
|
|
11
|
+
|
|
12
|
+
## Setup
|
|
13
|
+
|
|
14
|
+
* install the recommended extensions (amodio.tsl-problem-matcher, ms-vscode.extension-test-runner, and dbaeumer.vscode-eslint)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## Get up and running straight away
|
|
18
|
+
|
|
19
|
+
* Press `F5` to open a new window with your extension loaded.
|
|
20
|
+
* Run your command from the command palette by pressing (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and typing `Hello World`.
|
|
21
|
+
* Set breakpoints in your code inside `src/extension.ts` to debug your extension.
|
|
22
|
+
* Find output from your extension in the debug console.
|
|
23
|
+
|
|
24
|
+
## Make changes
|
|
25
|
+
|
|
26
|
+
* You can relaunch the extension from the debug toolbar after changing code in `src/extension.ts`.
|
|
27
|
+
* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## Explore the API
|
|
31
|
+
|
|
32
|
+
* You can open the full set of our API when you open the file `node_modules/@types/vscode/index.d.ts`.
|
|
33
|
+
|
|
34
|
+
## Run tests
|
|
35
|
+
|
|
36
|
+
* Install the [Extension Test Runner](https://marketplace.visualstudio.com/items?itemName=ms-vscode.extension-test-runner)
|
|
37
|
+
* Run the "watch" task via the **Tasks: Run Task** command. Make sure this is running, or tests might not be discovered.
|
|
38
|
+
* Open the Testing view from the activity bar and click the Run Test" button, or use the hotkey `Ctrl/Cmd + ; A`
|
|
39
|
+
* See the output of the test result in the Test Results view.
|
|
40
|
+
* Make changes to `src/test/extension.test.ts` or create new test files inside the `test` folder.
|
|
41
|
+
* The provided test runner will only consider files matching the name pattern `**.test.ts`.
|
|
42
|
+
* You can create folders inside the `test` folder to structure your tests any way you want.
|
|
43
|
+
|
|
44
|
+
## Go further
|
|
45
|
+
|
|
46
|
+
* Reduce the extension size and improve the startup time by [bundling your extension](https://code.visualstudio.com/api/working-with-extensions/bundling-extension).
|
|
47
|
+
* [Publish your extension](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) on the VS Code extension marketplace.
|
|
48
|
+
* Automate builds by setting up [Continuous Integration](https://code.visualstudio.com/api/working-with-extensions/continuous-integration).
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// A launch configuration that compiles the extension and then opens it inside a new window
|
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
|
3
|
+
// Hover to view descriptions of existing attributes.
|
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
+
{
|
|
6
|
+
"version": "0.2.0",
|
|
7
|
+
"configurations": [
|
|
8
|
+
{
|
|
9
|
+
"name": "Run Extension",
|
|
10
|
+
"type": "extensionHost",
|
|
11
|
+
"request": "launch",
|
|
12
|
+
"args": [
|
|
13
|
+
"--extensionDevelopmentPath=${workspaceFolder}"
|
|
14
|
+
],
|
|
15
|
+
"outFiles": [
|
|
16
|
+
"${workspaceFolder}/dist/**/*.js"
|
|
17
|
+
],
|
|
18
|
+
"preLaunchTask": "${defaultBuildTask}"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Place your settings in this file to overwrite default and user settings.
|
|
2
|
+
{
|
|
3
|
+
"files.exclude": {
|
|
4
|
+
"out": false, // set this to true to hide the "out" folder with the compiled JS files
|
|
5
|
+
"dist": false // set this to true to hide the "dist" folder with the compiled JS files
|
|
6
|
+
},
|
|
7
|
+
"search.exclude": {
|
|
8
|
+
"out": true, // set this to false to include "out" folder in search results
|
|
9
|
+
"dist": true // set this to false to include "dist" folder in search results
|
|
10
|
+
},
|
|
11
|
+
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
|
|
12
|
+
"typescript.tsc.autoDetect": "off"
|
|
13
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
|
2
|
+
// for the documentation about the tasks.json format
|
|
3
|
+
{
|
|
4
|
+
"version": "2.0.0",
|
|
5
|
+
"tasks": [
|
|
6
|
+
{
|
|
7
|
+
"label": "watch",
|
|
8
|
+
"dependsOn": [
|
|
9
|
+
"npm: watch:tsc",
|
|
10
|
+
"npm: watch:esbuild"
|
|
11
|
+
],
|
|
12
|
+
"presentation": {
|
|
13
|
+
"reveal": "never"
|
|
14
|
+
},
|
|
15
|
+
"group": {
|
|
16
|
+
"kind": "build",
|
|
17
|
+
"isDefault": true
|
|
18
|
+
},
|
|
19
|
+
"runOptions": {
|
|
20
|
+
"runOn": "folderOpen"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"type": "npm",
|
|
25
|
+
"script": "watch:esbuild",
|
|
26
|
+
"group": "build",
|
|
27
|
+
"problemMatcher": "$esbuild-watch",
|
|
28
|
+
"isBackground": true,
|
|
29
|
+
"label": "npm: watch:esbuild",
|
|
30
|
+
"presentation": {
|
|
31
|
+
"group": "watch",
|
|
32
|
+
"reveal": "never"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"type": "npm",
|
|
37
|
+
"script": "watch:tsc",
|
|
38
|
+
"group": "build",
|
|
39
|
+
"problemMatcher": "$tsc-watch",
|
|
40
|
+
"isBackground": true,
|
|
41
|
+
"label": "npm: watch:tsc",
|
|
42
|
+
"presentation": {
|
|
43
|
+
"group": "watch",
|
|
44
|
+
"reveal": "never"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"type": "npm",
|
|
49
|
+
"script": "watch-tests",
|
|
50
|
+
"problemMatcher": "$tsc-watch",
|
|
51
|
+
"isBackground": true,
|
|
52
|
+
"presentation": {
|
|
53
|
+
"reveal": "never",
|
|
54
|
+
"group": "watchers"
|
|
55
|
+
},
|
|
56
|
+
"group": "build"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"label": "tasks: watch-tests",
|
|
60
|
+
"dependsOn": [
|
|
61
|
+
"npm: watch",
|
|
62
|
+
"npm: watch-tests"
|
|
63
|
+
],
|
|
64
|
+
"problemMatcher": []
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// Place your settings in this file to overwrite default and user settings.
|
|
2
2
|
{
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
3
|
+
"files.exclude": {
|
|
4
|
+
"out": false, // set this to true to hide the "out" folder with the compiled JS files
|
|
5
|
+
"dist": false // set this to true to hide the "dist" folder with the compiled JS files
|
|
6
|
+
},
|
|
7
|
+
"search.exclude": {
|
|
8
|
+
"out": true, // set this to false to include "out" folder in search results
|
|
9
|
+
"dist": true // set this to false to include "dist" folder in search results
|
|
10
|
+
},
|
|
11
|
+
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
|
|
12
|
+
"typescript.tsc.autoDetect": "off"
|
|
13
|
+
}
|