├── .dockerignore ├── .editorconfig ├── .gitattributes ├── .github ├── assignment.yml ├── needs_more_info.yml └── workflows │ └── tests.yml ├── .gitignore ├── .npmignore ├── .vscode ├── launch.json └── settings.json ├── Dockerfile ├── LICENSE ├── README.md ├── SECURITY.md ├── build └── pipeline.yml ├── generators └── app │ ├── USAGE │ ├── dependencyVersions │ └── package.json │ ├── env.js │ ├── generate-colortheme.js │ ├── generate-command-js.js │ ├── generate-command-ts.js │ ├── generate-command-web.js │ ├── generate-extensionpack.js │ ├── generate-keymap.js │ ├── generate-language.js │ ├── generate-localization.js │ ├── generate-notebook-renderer.js │ ├── generate-snippets.js │ ├── index.js │ ├── prompts.js │ ├── templates │ ├── ext-colortheme │ │ ├── .gitattributes │ │ ├── .vscodeignore │ │ ├── CHANGELOG.md │ │ ├── README.md │ │ ├── gitignore │ │ ├── package.json │ │ ├── themes │ │ │ ├── color-theme.json │ │ │ ├── new-hc-black-color-theme.json │ │ │ ├── new-hc-light-color-theme.json │ │ │ ├── new-vs-color-theme.json │ │ │ ├── new-vs-dark-color-theme.json │ │ │ └── theme.tmTheme │ │ ├── vsc-extension-quickstart.md │ │ └── vscode │ │ │ └── launch.json │ ├── ext-command-js │ │ ├── .npmrc-pnpm │ │ ├── .vscode-test.mjs │ │ ├── .vscodeignore │ │ ├── .yarnrc │ │ ├── CHANGELOG.md │ │ ├── README.md │ │ ├── eslint.config.mjs │ │ ├── extension.js │ │ ├── gitignore │ │ ├── jsconfig.json │ │ ├── package.json │ │ ├── test │ │ │ └── extension.test.js │ │ ├── vsc-extension-quickstart.md │ │ └── vscode │ │ │ ├── extensions.json │ │ │ └── launch.json │ ├── ext-command-ts │ │ ├── .npmrc-pnpm │ │ ├── .vscode-test.mjs │ │ ├── .vscodeignore │ │ ├── .yarnrc │ │ ├── CHANGELOG.md │ │ ├── README.md │ │ ├── eslint.config.mjs │ │ ├── gitignore │ │ ├── package.json │ │ ├── src │ │ │ ├── extension.ts │ │ │ └── test │ │ │ │ └── extension.test.ts │ │ ├── tsconfig.json │ │ ├── vsc-extension-quickstart.md │ │ ├── vscode-esbuild │ │ │ ├── .vscodeignore │ │ │ ├── esbuild.js │ │ │ ├── package.json │ │ │ ├── tsconfig.json │ │ │ ├── vsc-extension-quickstart.md │ │ │ └── vscode │ │ │ │ ├── extensions.json │ │ │ │ ├── launch.json │ │ │ │ ├── settings.json │ │ │ │ └── tasks.json │ │ ├── vscode-webpack │ │ │ ├── .vscodeignore │ │ │ ├── package.json │ │ │ ├── tsconfig.json │ │ │ ├── vsc-extension-quickstart.md │ │ │ ├── vscode │ │ │ │ ├── extensions.json │ │ │ │ ├── launch.json │ │ │ │ ├── settings.json │ │ │ │ └── tasks.json │ │ │ └── webpack.config.js │ │ └── vscode │ │ │ ├── extensions.json │ │ │ ├── launch.json │ │ │ ├── settings.json │ │ │ └── tasks.json │ ├── ext-command-web │ │ ├── .npmrc-pnpm │ │ ├── .vscodeignore │ │ ├── .yarnrc │ │ ├── CHANGELOG.md │ │ ├── README.md │ │ ├── esbuild-package.json │ │ ├── esbuild.js │ │ ├── eslint.config.mjs │ │ ├── gitignore │ │ ├── src │ │ │ └── web │ │ │ │ ├── extension.ts │ │ │ │ └── test │ │ │ │ └── suite │ │ │ │ ├── esbuild-mochaTestRunner.ts │ │ │ │ ├── extension.test.ts │ │ │ │ └── webpack-mochaTestRunner.ts │ │ ├── tsconfig.json │ │ ├── vsc-extension-quickstart.md │ │ ├── vscode-esbuild │ │ │ ├── extensions.json │ │ │ ├── launch.json │ │ │ ├── settings.json │ │ │ └── tasks.json │ │ ├── vscode-webpack │ │ │ ├── extensions.json │ │ │ ├── launch.json │ │ │ ├── settings.json │ │ │ └── tasks.json │ │ ├── webpack-package.json │ │ └── webpack.config.js │ ├── ext-extensionpack │ │ ├── .gitattributes │ │ ├── .vscodeignore │ │ ├── CHANGELOG.md │ │ ├── README.md │ │ ├── gitignore │ │ ├── package.json │ │ ├── vsc-extension-quickstart.md │ │ └── vscode │ │ │ └── launch.json │ ├── ext-keymap │ │ ├── .gitattributes │ │ ├── .vscodeignore │ │ ├── CHANGELOG.md │ │ ├── README.md │ │ ├── gitignore │ │ ├── package.json │ │ ├── vsc-extension-quickstart.md │ │ └── vscode │ │ │ └── launch.json │ ├── ext-language │ │ ├── .gitattributes │ │ ├── .vscodeignore │ │ ├── CHANGELOG.md │ │ ├── README.md │ │ ├── gitignore │ │ ├── language-configuration.json │ │ ├── package.json │ │ ├── syntaxes │ │ │ ├── language.tmLanguage │ │ │ └── new.tmLanguage.json │ │ ├── vsc-extension-quickstart.md │ │ └── vscode │ │ │ └── launch.json │ ├── ext-localization │ │ ├── .gitattributes │ │ ├── .npmrc-pnpm │ │ ├── .vscodeignore │ │ ├── .yarnrc │ │ ├── CHANGELOG.md │ │ ├── README.md │ │ ├── gitignore │ │ ├── package.json │ │ └── vsc-extension-quickstart.md │ ├── ext-notebook-renderer │ │ ├── .gitattributes │ │ ├── .npmrc-pnpm │ │ ├── .vscode-test.mjs │ │ ├── .vscodeignore │ │ ├── .yarnrc │ │ ├── CHANGELOG.md │ │ ├── README.md │ │ ├── eslint.config.mjs │ │ ├── example │ │ │ └── notebook.ipynb │ │ ├── gitignore │ │ ├── package.json │ │ ├── src │ │ │ ├── client │ │ │ │ ├── css.d.ts │ │ │ │ ├── index.ts │ │ │ │ ├── render.ts │ │ │ │ ├── style.css │ │ │ │ └── tsconfig.json │ │ │ ├── extension │ │ │ │ ├── extension.ts │ │ │ │ └── tsconfig.json │ │ │ ├── test │ │ │ │ ├── extension.test.ts │ │ │ │ └── tsconfig.json │ │ │ └── tsconfig-base.json │ │ ├── tsconfig.json │ │ ├── vscode │ │ │ ├── extensions.json │ │ │ ├── launch.json │ │ │ ├── settings.json │ │ │ └── tasks.json │ │ └── webpack.config.js │ └── ext-snippets │ │ ├── .gitattributes │ │ ├── .vscodeignore │ │ ├── CHANGELOG.md │ │ ├── README.md │ │ ├── gitignore │ │ ├── package.json │ │ ├── snippets │ │ └── snippets.code-snippets │ │ ├── vsc-extension-quickstart.md │ │ └── vscode │ │ └── launch.json │ └── validator.js ├── jsconfig.json ├── package-lock.json ├── package.json ├── test ├── fixtures │ ├── grammars │ │ └── foo.tmLanguage.json │ ├── themes │ │ ├── new theme.tmTheme │ │ └── theme-74.tmTheme │ └── tmsnippets │ │ ├── Assert Equal.tmSnippet │ │ ├── Assert Not Equal.tmSnippet │ │ ├── Assert.tmSnippet │ │ └── TabInBody.tmSnippet ├── test-integration.mjs └── test.mjs ├── thirdpartynotices.txt └── yocode.png /.dockerignore: -------------------------------------------------------------------------------- 1 | /node_modules -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | end_of_line = lf 7 | indent_style = space 8 | indent_size = 2 9 | insert_final_newline = true 10 | trim_trailing_whitespace = true 11 | 12 | [*.js] 13 | indent_size = 4 14 | 15 | [*.json] 16 | indent_size = 4 17 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set default behavior to automatically normalize line endings. 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.github/assignment.yml: -------------------------------------------------------------------------------- 1 | { 2 | perform: true, 3 | assignees: [ aeschli ] 4 | } 5 | -------------------------------------------------------------------------------- /.github/needs_more_info.yml: -------------------------------------------------------------------------------- 1 | { 2 | daysUntilClose: 7, 3 | needsMoreInfoLabel: 'needs more info', 4 | perform: true, 5 | closeComment: "This issue has been closed automatically because it needs more information and has not had recent activity. See also our [issue reporting](https://aka.ms/vscodeissuereporting) guidelines.\n\nHappy Coding!" 6 | } 7 | -------------------------------------------------------------------------------- /.github/workflows/tests.yml: -------------------------------------------------------------------------------- 1 | name: Tests CI 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | build: 11 | 12 | runs-on: ubuntu-latest 13 | 14 | strategy: 15 | matrix: 16 | node-version: [18.x, 20.x] 17 | # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ 18 | 19 | steps: 20 | - uses: actions/checkout@v3 21 | - name: Use Node.js ${{ matrix.node-version }} 22 | uses: actions/setup-node@v3 23 | with: 24 | node-version: ${{ matrix.node-version }} 25 | - run: npm ci 26 | - name: Run headless test 27 | uses: coactions/setup-xvfb@v1 28 | with: 29 | run: npm test 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | yarn.lock -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | /test 2 | /.vscode 3 | /.github 4 | /.editorconfig 5 | /.eslintignore 6 | /.eslintrc.yml 7 | /.gitattributes 8 | /.travis.yml 9 | /jsconfig.json 10 | /.azure-pipelines.yml 11 | /.dockerignore 12 | /Dockerfile -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible Node.js debug attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | // make sure to have this generator npm-linked: 9 | // $ git clone https://github.com/Microsoft/vscode-generator-code 10 | // $ cd vscode-generator-code 11 | // $ npm link 12 | // 13 | "type": "node", 14 | "request": "launch", 15 | "name": "yeoman code", 16 | "program": "${workspaceFolder}/node_modules/yeoman-environment/cli/index.js", 17 | "args": [ "run", "code" ], 18 | "cwd": "${workspaceFolder}", 19 | "console": "integratedTerminal", 20 | "internalConsoleOptions": "neverOpen" 21 | }, 22 | { 23 | "type": "node", 24 | "request": "launch", 25 | "name": "Mocha Tests", 26 | "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha", 27 | "cwd": "${workspaceFolder}", 28 | "console": "integratedTerminal", 29 | "internalConsoleOptions": "openOnSessionStart" 30 | } 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | // Place your settings in this file to overwrite default and user settings. 2 | { 3 | "editor.insertSpaces": true, 4 | "files.eol": "\n", 5 | "files.trimTrailingWhitespace": true, 6 | "git.branchProtection": [ 7 | "main" 8 | ], 9 | "git.branchProtectionPrompt": "alwaysCommitToNewBranch", 10 | "git.branchRandomName.enable": true, 11 | "githubPullRequests.assignCreated": "${user}", 12 | "githubPullRequests.defaultMergeMethod": "squash" 13 | } 14 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:lts-alpine3.12 2 | LABEL Maintainer="contact@snpranav.com" 3 | 4 | # Installing GIT 5 | RUN apk update && apk add git 6 | 7 | # Installing Yeoman and VS Code Extension Generator globally 8 | RUN npm install -g yo generator-code 9 | RUN chown -R node:node /usr/local/lib/node_modules 10 | 11 | WORKDIR /usr/src/app 12 | 13 | COPY package*.json ./ 14 | RUN npm install 15 | 16 | COPY . . 17 | 18 | RUN chown -R node:node /usr/src/app 19 | USER node 20 | ENTRYPOINT [ "yo", "code" ] -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | vscode-generator-code 2 | 3 | The MIT License (MIT) 4 | 5 | Copyright (c) Microsoft Corporation 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Yo Code - Extension and Customization Generator 2 | [![npm Package](https://img.shields.io/npm/v/generator-code.svg?style=flat-square)](https://www.npmjs.org/package/generator-code) 3 | [![NPM Downloads](https://img.shields.io/npm/dm/generator-code.svg)](https://npmjs.org/package/generator-code) 4 | [![Build Status](https://github.com/microsoft/vscode-generator-code/actions/workflows/tests.yml/badge.svg)](https://github.com/microsoft/vscode-generator-code/actions/tests.yml) 5 | [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) 6 | 7 | We have written a Yeoman generator to help get you started. We plan to add templates for most extension/customization types into this. 8 | 9 | ## Install the Generator 10 | 11 | Install Yeoman and the VS Code Extension generator: 12 | 13 | ```bash 14 | npm install -g yo generator-code 15 | ``` 16 | 17 | ## Run Yo Code 18 | 19 | The Yeoman generator will walk you through the steps required to create your customization or extension prompting for the required information. 20 | 21 | To launch the generator simply type: 22 | 23 | ```bash 24 | yo code 25 | ``` 26 | 27 | ![The command generator](yocode.png) 28 | 29 | ## Generator Output 30 | 31 | These templates will: 32 | 33 | * Create a base folder structure 34 | * Template out a rough `package.json` 35 | * Import any assets required for your extension e.g. tmBundles or the VS Code Library 36 | * For Extensions: Set-up `launch.json` for running your extension and attaching to a process 37 | 38 | ## Command line 39 | 40 | ``` 41 | Usage: 42 | yo code [] [options] 43 | 44 | Argument (optional): 45 | The destination to create the extension in, absolute or relative to the current working 46 | directory. Use '.' for the current folder. 47 | If not provided, defaults to a folder in the current working directory with the extension 48 | display name. 49 | 50 | Options: 51 | -h, --help # Print the generator's options and usage 52 | -i, --insiders # Show the insiders options for the generator 53 | -q, --quick # Quick mode, skip all optional prompts and use defaults 54 | -o, --open # Open the generated extension in Visual Studio Code 55 | -O, --openInInsiders # Open the generated extension in Visual Studio Code Insiders 56 | -t, --extensionType # ts, js, colortheme, language, snippets, keymap... 57 | --extensionId # Id of the extension 58 | --extensionDescription # Description of the extension 59 | --pkgManager # 'npm', 'yarn' or 'pnpm' 60 | --bundle # 'webpack', 'esbuild'. Bundle the extension with webpack or esbuild 61 | --gitInit # Initialize a git repo 62 | 63 | Example usages: 64 | yo code # Create an extension in a folder with the extension's name. 65 | yo code . -O # Create an extension in current folder and open with code-insiders 66 | yo code Hello -t=ts -q # Create an TypeScript extension in './Hello', skip prompts, use defaults. 67 | yo code --insiders # Show the insiders options for the generator 68 | ``` 69 | 70 | ## Run Generator using Docker 71 | 72 | If you don't want to install nodejs or any node packages, use this method to containerize the generator. 73 | 74 | Go into your project directory. 75 | 76 | ```bash 77 | cd 78 | ``` 79 | 80 | Build the docker image from the docker file. 81 | 82 | ```bash 83 | docker build -t vscode-generator-code . 84 | ``` 85 | 86 | Create a docker container with volumes. 87 | 88 | ```bash 89 | docker run -it -v $(pwd):/usr/src/app vscode-generator-code 90 | ``` 91 | 92 | ## Local development 93 | 94 | After making necessary changes, run `npm link` before running `yo code` to 95 | test the local version. 96 | 97 | You can learn more about Yeoman generator development on its 98 | [documentation website](https://yeoman.io/authoring/index.html). 99 | 100 | ## History 101 | 102 | * 1.0.0: Generates a VS Code extension for TypeScript 2.0.3 103 | * 0.10.x: Generates a VS Code extension for TypeScript 1.8.10 104 | 105 | ## License 106 | 107 | [MIT](LICENSE) 108 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Security 4 | 5 | Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). 6 | 7 | If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)), please report it to us as described below. 8 | 9 | ## Reporting Security Issues 10 | 11 | **Please do not report security vulnerabilities through public GitHub issues.** 12 | 13 | Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report). 14 | 15 | If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc). 16 | 17 | You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc). 18 | 19 | Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: 20 | 21 | * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) 22 | * Full paths of source file(s) related to the manifestation of the issue 23 | * The location of the affected source code (tag/branch/commit or direct URL) 24 | * Any special configuration required to reproduce the issue 25 | * Step-by-step instructions to reproduce the issue 26 | * Proof-of-concept or exploit code (if possible) 27 | * Impact of the issue, including how an attacker might exploit the issue 28 | 29 | This information will help us triage your report more quickly. 30 | 31 | If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty) page for more details about our active programs. 32 | 33 | ## Preferred Languages 34 | 35 | We prefer all communications to be in English. 36 | 37 | ## Policy 38 | 39 | Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd). 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/pipeline.yml: -------------------------------------------------------------------------------- 1 | name: $(Date:yyyyMMdd)$(Rev:.r) 2 | 3 | trigger: 4 | batch: true 5 | branches: 6 | include: 7 | - main 8 | pr: none 9 | 10 | resources: 11 | repositories: 12 | - repository: templates 13 | type: github 14 | name: microsoft/vscode-engineering 15 | ref: main 16 | endpoint: Monaco 17 | 18 | parameters: 19 | - name: publishPackage 20 | displayName: 🚀 Publish generator-code 21 | type: boolean 22 | default: false 23 | 24 | extends: 25 | template: azure-pipelines/npm-package/pipeline.yml@templates 26 | parameters: 27 | npmPackages: 28 | - name: generator-code 29 | 30 | buildSteps: 31 | - script: npm i 32 | displayName: Install dependencies 33 | 34 | testPlatforms: 35 | - name: Linux 36 | nodeVersions: 37 | - 18.x 38 | - 20.x 39 | - name: MacOS 40 | nodeVersions: 41 | - 18.x 42 | - 20.x 43 | - name: Windows 44 | nodeVersions: 45 | - 18.x 46 | - 20.x 47 | 48 | testSteps: 49 | - script: npm i 50 | displayName: Install dependencies 51 | 52 | - bash: | 53 | /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & 54 | echo ">>> Started xvfb" 55 | displayName: Start xvfb 56 | condition: eq(variables['Agent.OS'], 'Linux') 57 | 58 | - script: npm test 59 | displayName: Test npm package 60 | env: 61 | DISPLAY: ':99.0' 62 | 63 | publishPackage: ${{ parameters.publishPackage }} 64 | publishRequiresApproval: false 65 | -------------------------------------------------------------------------------- /generators/app/USAGE: -------------------------------------------------------------------------------- 1 | Example usages: 2 | yo code # Create an extension in a folder with the extension's name as prompted in the generator. 3 | yo code . -O # Create an extension in current folder and open with code-insiders 4 | yo code Hello -t=ts -q # Create an TypeScript extension in './Hello', skip prompts, use defaults. 5 | yo code --insiders # Show the insiders options for the generator -------------------------------------------------------------------------------- /generators/app/dependencyVersions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "generator-code-dependencies-versions", 3 | "description": "Helper file to manage the versions of the node modules used by the generators. Named package.json so the VS Code dependencies completions work. Must be in a subfolder due to #325", 4 | "version": "0.0.0", 5 | "private": true, 6 | "dependencies": { 7 | "@types/mocha": "^10.0.10", 8 | "@types/node": "20.x", 9 | "@types/assert": "^1.5.11", 10 | "@typescript-eslint/eslint-plugin": "^8.31.1", 11 | "@typescript-eslint/parser": "^8.31.1", 12 | "eslint": "^9.25.1", 13 | "glob": "^11.0.2", 14 | "mocha": "^11.1.0", 15 | "typescript": "^5.8.3", 16 | "@vscode/test-cli": "^0.0.10", 17 | "@vscode/test-electron": "^2.5.2", 18 | "@vscode/test-web": "^0.0.69", 19 | "@types/webpack-env": "^1.18.8", 20 | "@types/vscode-notebook-renderer": "^1.72.3", 21 | "concurrently": "^9.1.2", 22 | "css-loader": "^7.1.2", 23 | "fork-ts-checker-webpack-plugin": "^9.1.0", 24 | "style-loader": "^4.0.0", 25 | "ts-loader": "^9.5.2", 26 | "vscode-dts": "^0.3.3", 27 | "vscode-notebook-error-overlay": "^1.1.0", 28 | "webpack": "^5.99.7", 29 | "util": "^0.12.5", 30 | "webpack-cli": "^6.0.1", 31 | "webpack-dev-server": "^5.2.1", 32 | "assert": "^2.1.0", 33 | "process": "^0.11.10", 34 | "npm-run-all": "^4.1.5", 35 | "esbuild": "^0.25.3", 36 | "@esbuild-plugins/node-globals-polyfill": "^0.2.3" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /generators/app/env.js: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------- 2 | * Copyright (C) Microsoft Corporation. All rights reserved. 3 | *--------------------------------------------------------*/ 4 | 'use strict'; 5 | import request from 'request-light'; 6 | import * as fs from 'fs'; 7 | import * as path from 'path'; 8 | import { fileURLToPath } from 'url'; 9 | 10 | const fallbackVersion = '^1.54.0'; 11 | let versionPromise = undefined; 12 | 13 | export function getLatestVSCodeVersion() { 14 | if (!versionPromise) { 15 | versionPromise = request.xhr({ url: 'https://update.code.visualstudio.com/api/releases/stable', headers: { "X-API-Version": "2" } }).then(res => { 16 | if (res.status === 200) { 17 | try { 18 | var tagsAndCommits = JSON.parse(res.responseText); 19 | if (Array.isArray(tagsAndCommits) && tagsAndCommits.length > 0) { 20 | var segments = tagsAndCommits[0].version.split('.'); 21 | if (segments.length === 3) { 22 | return '^' + segments[0] + '.' + segments[1] + '.0'; 23 | } 24 | } 25 | } catch (e) { 26 | console.log('Problem parsing version: ' + res.responseText, e); 27 | } 28 | } else { 29 | console.warn('Unable to evaluate the latest vscode version: Status code: ' + res.status + ', ' + res.responseText); 30 | } 31 | console.warn('Falling back to: ' + fallbackVersion); 32 | return fallbackVersion; 33 | }, err => { 34 | console.warn('Unable to evaluate the latest vscode version: Error: ', err); 35 | console.warn('Falling back to: ' + fallbackVersion); 36 | return fallbackVersion; 37 | }); 38 | } 39 | return versionPromise; 40 | }; 41 | 42 | export async function getDependencyVersions() { 43 | const vscodeVersion = await getLatestVSCodeVersion(); 44 | const currentFileName = fileURLToPath(import.meta.url); 45 | const versions = JSON.parse((await fs.promises.readFile(path.join(currentFileName, '..', 'dependencyVersions', 'package.json'))).toString()).dependencies; 46 | versions["@types/vscode"] = vscodeVersion 47 | return versions; 48 | } 49 | -------------------------------------------------------------------------------- /generators/app/generate-command-js.js: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------- 2 | * Copyright (C) Microsoft Corporation. All rights reserved. 3 | *--------------------------------------------------------*/ 4 | import Generator from 'yeoman-generator'; 5 | import * as prompts from './prompts.js'; 6 | 7 | 8 | /** 9 | * @typedef {{ 10 | * checkJavaScript: boolean 11 | * } & import('./index.js').ExtensionConfig} ExtensionConfig 12 | */ 13 | 14 | /** 15 | * @type {import('./index.js').ExtensionGenerator} 16 | */ 17 | export default { 18 | id: 'ext-command-js', 19 | aliases: ['js', 'command-js'], 20 | name: 'New Extension (JavaScript)', 21 | /** 22 | * @param {Generator} generator 23 | * @param {ExtensionConfig} extensionConfig 24 | */ 25 | prompting: async (generator, extensionConfig) => { 26 | await prompts.askForExtensionDisplayName(generator, extensionConfig); 27 | await prompts.askForExtensionId(generator, extensionConfig); 28 | await prompts.askForExtensionDescription(generator, extensionConfig); 29 | 30 | extensionConfig.checkJavaScript = false; 31 | await generator.prompt({ 32 | type: 'confirm', 33 | name: 'checkJavaScript', 34 | message: 'Enable JavaScript type checking in \'jsconfig.json\'?', 35 | default: false 36 | }).then(strictJavaScriptAnswer => { 37 | extensionConfig.checkJavaScript = strictJavaScriptAnswer.checkJavaScript; 38 | }); 39 | 40 | await prompts.askForGit(generator, extensionConfig); 41 | await prompts.askForPackageManager(generator, extensionConfig); 42 | }, 43 | 44 | /** 45 | * @param {Generator} generator 46 | * @param {ExtensionConfig} extensionConfig 47 | */ 48 | writing: (generator, extensionConfig) => { 49 | generator.fs.copy(generator.templatePath('vscode'), generator.destinationPath('.vscode')); 50 | generator.fs.copy(generator.templatePath('test'), generator.destinationPath('test')); 51 | 52 | generator.fs.copy(generator.templatePath('.vscodeignore'), generator.destinationPath('.vscodeignore')); 53 | 54 | if (extensionConfig.gitInit) { 55 | generator.fs.copy(generator.templatePath('gitignore'), generator.destinationPath('.gitignore')); 56 | } 57 | 58 | generator.fs.copyTpl(generator.templatePath('README.md'), generator.destinationPath('README.md'), extensionConfig); 59 | generator.fs.copyTpl(generator.templatePath('CHANGELOG.md'), generator.destinationPath('CHANGELOG.md'), extensionConfig); 60 | generator.fs.copyTpl(generator.templatePath('vsc-extension-quickstart.md'), generator.destinationPath('vsc-extension-quickstart.md'), extensionConfig); 61 | generator.fs.copyTpl(generator.templatePath('jsconfig.json'), generator.destinationPath('jsconfig.json'), extensionConfig); 62 | 63 | generator.fs.copyTpl(generator.templatePath('extension.js'), generator.destinationPath('extension.js'), extensionConfig); 64 | generator.fs.copyTpl(generator.templatePath('package.json'), generator.destinationPath('package.json'), extensionConfig); 65 | generator.fs.copy(generator.templatePath('.vscode-test.mjs'), generator.destinationPath('.vscode-test.mjs')); 66 | generator.fs.copyTpl(generator.templatePath('eslint.config.mjs'), generator.destinationPath('eslint.config.mjs'), extensionConfig); 67 | 68 | if (extensionConfig.pkgManager === 'yarn') { 69 | generator.fs.copyTpl(generator.templatePath('.yarnrc'), generator.destinationPath('.yarnrc'), extensionConfig); 70 | } else if (extensionConfig.pkgManager === 'pnpm') { 71 | generator.fs.copyTpl(generator.templatePath('.npmrc-pnpm'), generator.destinationPath('.npmrc'), extensionConfig); 72 | } 73 | 74 | extensionConfig.installDependencies = true; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /generators/app/generate-command-ts.js: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------- 2 | * Copyright (C) Microsoft Corporation. All rights reserved. 3 | *--------------------------------------------------------*/ 4 | import Generator from 'yeoman-generator'; 5 | import { Chalk } from 'chalk'; 6 | import * as prompts from './prompts.js'; 7 | 8 | /** 9 | * @typedef {import('./index.js').ExtensionConfig} ExtensionConfig 10 | */ 11 | 12 | 13 | const chalk = new Chalk(); 14 | 15 | /** 16 | * @type {import('./index.js').ExtensionGenerator} 17 | */ 18 | export default { 19 | id: 'ext-command-ts', 20 | aliases: ['ts', 'command-ts'], 21 | name: 'New Extension (TypeScript)', 22 | insidersName: 'New Extension with Proposed API (TypeScript)', 23 | /** 24 | * @param {Generator} generator 25 | * @param {ExtensionConfig} extensionConfig 26 | */ 27 | prompting: async (generator, extensionConfig) => { 28 | await prompts.askForExtensionDisplayName(generator, extensionConfig); 29 | await prompts.askForExtensionId(generator, extensionConfig); 30 | await prompts.askForExtensionDescription(generator, extensionConfig); 31 | 32 | await prompts.askForGit(generator, extensionConfig); 33 | await prompts.askForBundler(generator, extensionConfig); 34 | await prompts.askForPackageManager(generator, extensionConfig); 35 | }, 36 | /** 37 | * @param {Generator} generator 38 | * @param {ExtensionConfig} extensionConfig 39 | */ 40 | writing: (generator, extensionConfig) => { 41 | const bundler = extensionConfig.bundler; 42 | if (bundler && (bundler === 'webpack' || bundler === 'esbuild')) { 43 | const bundlerPath = bundler === 'esbuild' ? 'vscode-esbuild' : 'vscode-webpack'; 44 | const bundlerFile = bundler === 'esbuild' ? 'esbuild.js' : 'webpack.config.js'; 45 | generator.fs.copy(generator.templatePath(bundlerPath, 'vscode'), generator.destinationPath('.vscode')); 46 | generator.fs.copyTpl(generator.templatePath(bundlerPath, 'package.json'), generator.destinationPath('package.json'), extensionConfig); 47 | generator.fs.copyTpl(generator.templatePath(bundlerPath, 'tsconfig.json'), generator.destinationPath('tsconfig.json'), extensionConfig); 48 | generator.fs.copyTpl(generator.templatePath(bundlerPath, '.vscodeignore'), generator.destinationPath('.vscodeignore'), extensionConfig); 49 | generator.fs.copyTpl(generator.templatePath(bundlerPath, bundlerFile), generator.destinationPath(bundlerFile), extensionConfig); 50 | generator.fs.copyTpl(generator.templatePath(bundlerPath, 'vsc-extension-quickstart.md'), generator.destinationPath('vsc-extension-quickstart.md'), extensionConfig); 51 | } else { 52 | generator.fs.copy(generator.templatePath('vscode'), generator.destinationPath('.vscode')); 53 | generator.fs.copyTpl(generator.templatePath('package.json'), generator.destinationPath('package.json'), extensionConfig); 54 | generator.fs.copyTpl(generator.templatePath('tsconfig.json'), generator.destinationPath('tsconfig.json'), extensionConfig); 55 | generator.fs.copyTpl(generator.templatePath('.vscodeignore'), generator.destinationPath('.vscodeignore'), extensionConfig); 56 | generator.fs.copyTpl(generator.templatePath('vsc-extension-quickstart.md'), generator.destinationPath('vsc-extension-quickstart.md'), extensionConfig); 57 | } 58 | 59 | if (extensionConfig.gitInit) { 60 | generator.fs.copy(generator.templatePath('gitignore'), generator.destinationPath('.gitignore')); 61 | } 62 | generator.fs.copyTpl(generator.templatePath('README.md'), generator.destinationPath('README.md'), extensionConfig); 63 | generator.fs.copyTpl(generator.templatePath('CHANGELOG.md'), generator.destinationPath('CHANGELOG.md'), extensionConfig); 64 | generator.fs.copyTpl(generator.templatePath('src/extension.ts'), generator.destinationPath('src/extension.ts'), extensionConfig); 65 | generator.fs.copy(generator.templatePath('src/test'), generator.destinationPath('src/test')); 66 | generator.fs.copy(generator.templatePath('.vscode-test.mjs'), generator.destinationPath('.vscode-test.mjs')); 67 | generator.fs.copy(generator.templatePath('eslint.config.mjs'), generator.destinationPath('eslint.config.mjs')); 68 | 69 | if (extensionConfig.pkgManager === 'yarn') { 70 | generator.fs.copyTpl(generator.templatePath('.yarnrc'), generator.destinationPath('.yarnrc'), extensionConfig); 71 | } else if (extensionConfig.pkgManager === 'pnpm') { 72 | generator.fs.copyTpl(generator.templatePath('.npmrc-pnpm'), generator.destinationPath('.npmrc'), extensionConfig); 73 | } 74 | 75 | extensionConfig.installDependencies = true; 76 | extensionConfig.proposedAPI = extensionConfig.insiders; 77 | }, 78 | 79 | /** 80 | * @param {Generator} generator 81 | * @param {ExtensionConfig} extensionConfig 82 | */ 83 | endMessage: (generator, extensionConfig) => { 84 | if (extensionConfig.bundler === 'webpack') { 85 | generator.log(chalk.yellow(`To run the extension you need to install the recommended extension 'amodio.tsl-problem-matcher'.`)); 86 | generator.log(''); 87 | } else if (extensionConfig.bundler === 'esbuild') { 88 | generator.log(chalk.yellow(`To run the extension you need to install the recommended extension 'connor4312.esbuild-problem-matchers'.`)); 89 | generator.log(''); 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /generators/app/generate-command-web.js: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------- 2 | * Copyright (C) Microsoft Corporation. All rights reserved. 3 | *--------------------------------------------------------*/ 4 | import Generator from 'yeoman-generator'; 5 | import { Chalk } from 'chalk'; 6 | import * as prompts from './prompts.js'; 7 | 8 | /** 9 | * @typedef {import('./index.js').ExtensionConfig} ExtensionConfig 10 | */ 11 | const chalk = new Chalk(); 12 | 13 | /** 14 | * @type {import('./index.js').ExtensionGenerator} 15 | */ 16 | export default { 17 | id: 'ext-command-web', 18 | aliases: ['web', 'command-web'], 19 | name: 'New Web Extension (TypeScript)', 20 | /** 21 | * @param {Generator} generator 22 | * @param {ExtensionConfig} extensionConfig 23 | */ 24 | prompting: async (generator, extensionConfig) => { 25 | await prompts.askForExtensionDisplayName(generator, extensionConfig); 26 | await prompts.askForExtensionId(generator, extensionConfig); 27 | await prompts.askForExtensionDescription(generator, extensionConfig); 28 | 29 | await prompts.askForGit(generator, extensionConfig); 30 | await prompts.askForBundler(generator, extensionConfig, false, 'webpack'); 31 | await prompts.askForPackageManager(generator, extensionConfig); 32 | }, 33 | /** 34 | * @param {Generator} generator 35 | * @param {ExtensionConfig} extensionConfig 36 | */ 37 | writing: (generator, extensionConfig) => { 38 | const bundler = extensionConfig.bundler; 39 | if (bundler === 'esbuild') { 40 | generator.fs.copy(generator.templatePath('vscode-esbuild'), generator.destinationPath('.vscode')); 41 | } else { 42 | generator.fs.copy(generator.templatePath('vscode-webpack'), generator.destinationPath('.vscode')); 43 | } 44 | 45 | generator.fs.copy(generator.templatePath('.vscodeignore'), generator.destinationPath('.vscodeignore')); 46 | if (extensionConfig.gitInit) { 47 | generator.fs.copy(generator.templatePath('gitignore'), generator.destinationPath('.gitignore')); 48 | } 49 | generator.fs.copyTpl(generator.templatePath('README.md'), generator.destinationPath('README.md'), extensionConfig); 50 | generator.fs.copyTpl(generator.templatePath('CHANGELOG.md'), generator.destinationPath('CHANGELOG.md'), extensionConfig); 51 | generator.fs.copyTpl(generator.templatePath('vsc-extension-quickstart.md'), generator.destinationPath('vsc-extension-quickstart.md'), extensionConfig); 52 | generator.fs.copyTpl(generator.templatePath('tsconfig.json'), generator.destinationPath('tsconfig.json'), extensionConfig); 53 | 54 | generator.fs.copyTpl(generator.templatePath('src/web/extension.ts'), generator.destinationPath('src/web/extension.ts'), extensionConfig); 55 | 56 | generator.fs.copy(generator.templatePath('src/web/test/suite/extension.test.ts'), generator.destinationPath('src/web/test/suite/extension.test.ts')); 57 | 58 | if (bundler === 'esbuild') { 59 | generator.fs.copyTpl(generator.templatePath('esbuild.js'), generator.destinationPath('esbuild.js'), extensionConfig); 60 | generator.fs.copyTpl(generator.templatePath('esbuild-package.json'), generator.destinationPath('package.json'), extensionConfig); 61 | generator.fs.copy(generator.templatePath('src/web/test/suite/esbuild-mochaTestRunner.ts'), generator.destinationPath('src/web/test/suite/mochaTestRunner.ts')); 62 | } else { 63 | generator.fs.copyTpl(generator.templatePath('webpack.config.js'), generator.destinationPath('webpack.config.js'), extensionConfig); 64 | generator.fs.copyTpl(generator.templatePath('webpack-package.json'), generator.destinationPath('package.json'), extensionConfig); 65 | generator.fs.copy(generator.templatePath('src/web/test/suite/webpack-mochaTestRunner.ts'), generator.destinationPath('src/web/test/suite/index.ts')); 66 | } 67 | 68 | generator.fs.copy(generator.templatePath('eslint.config.mjs'), generator.destinationPath('eslint.config.mjs')); 69 | 70 | if (extensionConfig.pkgManager === 'yarn') { 71 | generator.fs.copyTpl(generator.templatePath('.yarnrc'), generator.destinationPath('.yarnrc'), extensionConfig); 72 | } else if (extensionConfig.pkgManager === 'pnpm') { 73 | generator.fs.copyTpl(generator.templatePath('.npmrc-pnpm'), generator.destinationPath('.npmrc'), extensionConfig); 74 | } 75 | 76 | extensionConfig.installDependencies = true; 77 | extensionConfig.proposedAPI = false; 78 | }, 79 | /** 80 | * @param {Generator} generator 81 | * @param {ExtensionConfig} extensionConfig 82 | */ 83 | endMessage: (generator, extensionConfig) => { 84 | if (extensionConfig.bundler === 'webpack') { 85 | generator.log(chalk.yellow(`To run the extension you need to install the recommended extension 'amodio.tsl-problem-matcher'.`)); 86 | generator.log(''); 87 | } else if (extensionConfig.bundler === 'esbuild') { 88 | generator.log(chalk.yellow(`To run the extension you need to install the recommended extension 'connor4312.esbuild-problem-matchers'.`)); 89 | generator.log(''); 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /generators/app/generate-extensionpack.js: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------- 2 | * Copyright (C) Microsoft Corporation. All rights reserved. 3 | *--------------------------------------------------------*/ 4 | import Generator from 'yeoman-generator'; 5 | import * as prompts from './prompts.js'; 6 | import * as childProcess from 'child_process'; 7 | 8 | 9 | /** 10 | * @typedef {{ 11 | * extensionList: string[], 12 | * isCustomization: boolean 13 | * } & import('./index.js').ExtensionConfig} ExtensionConfig 14 | */ 15 | 16 | /** 17 | * @type {import('./index.js').ExtensionGenerator} 18 | */ 19 | export default { 20 | id: 'ext-extensionpack', 21 | aliases: ['extensionpack'], 22 | name: 'New Extension Pack', 23 | /** 24 | * @param {Generator} generator 25 | * @param {ExtensionConfig} extensionConfig 26 | */ 27 | prompting: async (generator, extensionConfig) => { 28 | 29 | await askForExtensionPackInfo(generator, extensionConfig); 30 | 31 | await prompts.askForExtensionDisplayName(generator, extensionConfig); 32 | await prompts.askForExtensionId(generator, extensionConfig); 33 | await prompts.askForExtensionDescription(generator, extensionConfig); 34 | 35 | await prompts.askForGit(generator, extensionConfig); 36 | }, 37 | /** 38 | * @param {Generator} generator 39 | * @param {ExtensionConfig} extensionConfig 40 | */ 41 | writing: (generator, extensionConfig) => { 42 | generator.fs.copy(generator.templatePath('vscode'), generator.destinationPath('.vscode')); 43 | generator.fs.copyTpl(generator.templatePath('package.json'), generator.destinationPath('package.json'), extensionConfig); 44 | generator.fs.copyTpl(generator.templatePath('vsc-extension-quickstart.md'), generator.destinationPath('vsc-extension-quickstart.md'), extensionConfig); 45 | generator.fs.copyTpl(generator.templatePath('README.md'), generator.destinationPath('README.md'), extensionConfig); 46 | generator.fs.copyTpl(generator.templatePath('CHANGELOG.md'), generator.destinationPath('CHANGELOG.md'), extensionConfig); 47 | generator.fs.copy(generator.templatePath('.vscodeignore'), generator.destinationPath('.vscodeignore')); 48 | if (extensionConfig.gitInit) { 49 | generator.fs.copy(generator.templatePath('gitignore'), generator.destinationPath('.gitignore')); 50 | generator.fs.copy(generator.templatePath('.gitattributes'), generator.destinationPath('.gitattributes')); 51 | } 52 | } 53 | } 54 | /** 55 | * @param {Generator} generator 56 | * @param {ExtensionConfig} extensionConfig 57 | */ 58 | function askForExtensionPackInfo(generator, extensionConfig) { 59 | extensionConfig.isCustomization = true; 60 | const defaultExtensionList = ['publisher.extensionName']; 61 | 62 | const getExtensionList = () => 63 | new Promise((resolve, reject) => { 64 | childProcess.exec( 65 | 'code --list-extensions', 66 | (error, stdout, stderr) => { 67 | if (error) { 68 | generator.log.error(error); 69 | } else { 70 | let out = stdout.trim(); 71 | if (out.length > 0) { 72 | extensionConfig.extensionList = out.split(/\s/); 73 | } 74 | } 75 | resolve(); 76 | } 77 | ); 78 | }); 79 | 80 | return generator.prompt({ 81 | type: 'confirm', 82 | name: 'addExtensions', 83 | message: 'Add the currently installed extensions to the extension pack?', 84 | default: true 85 | }).then(addExtensionsAnswer => { 86 | extensionConfig.extensionList = defaultExtensionList; 87 | if (addExtensionsAnswer.addExtensions) { 88 | return getExtensionList(); 89 | } 90 | }); 91 | } -------------------------------------------------------------------------------- /generators/app/generate-keymap.js: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------- 2 | * Copyright (C) Microsoft Corporation. All rights reserved. 3 | *--------------------------------------------------------*/ 4 | import Generator from 'yeoman-generator'; 5 | import * as prompts from './prompts.js'; 6 | 7 | /** 8 | * @typedef { import('./index.js').ExtensionConfig} ExtensionConfig 9 | */ 10 | 11 | /** 12 | * @type {import('./index.js').ExtensionGenerator} 13 | */ 14 | export default { 15 | id: 'ext-keymap', 16 | aliases: ['keymap'], 17 | name: 'New Keymap', 18 | /** 19 | * @param {Generator} generator 20 | * @param {ExtensionConfig} extensionConfig 21 | */ 22 | prompting: async (generator, extensionConfig) => { 23 | await prompts.askForExtensionDisplayName(generator, extensionConfig); 24 | await prompts.askForExtensionId(generator, extensionConfig); 25 | await prompts.askForExtensionDescription(generator, extensionConfig); 26 | 27 | await prompts.askForGit(generator, extensionConfig); 28 | }, 29 | /** 30 | * @param {Generator} generator 31 | * @param {ExtensionConfig} extensionConfig 32 | */ 33 | writing: (generator, extensionConfig) => { 34 | generator.fs.copy(generator.templatePath('vscode'), generator.destinationPath('.vscode')); 35 | generator.fs.copyTpl(generator.templatePath('package.json'), generator.destinationPath('package.json'), extensionConfig); 36 | generator.fs.copyTpl(generator.templatePath('vsc-extension-quickstart.md'), generator.destinationPath('vsc-extension-quickstart.md'), extensionConfig); 37 | generator.fs.copyTpl(generator.templatePath('README.md'), generator.destinationPath('README.md'), extensionConfig); 38 | generator.fs.copyTpl(generator.templatePath('CHANGELOG.md'), generator.destinationPath('CHANGELOG.md'), extensionConfig); 39 | generator.fs.copy(generator.templatePath('.vscodeignore'), generator.destinationPath('.vscodeignore')); 40 | if (extensionConfig.gitInit) { 41 | generator.fs.copy(generator.templatePath('gitignore'), generator.destinationPath('.gitignore')); 42 | generator.fs.copy(generator.templatePath('.gitattributes'), generator.destinationPath('.gitattributes')); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /generators/app/generate-localization.js: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------- 2 | * Copyright (C) Microsoft Corporation. All rights reserved. 3 | *--------------------------------------------------------*/ 4 | import Generator from 'yeoman-generator'; 5 | import * as prompts from './prompts.js'; 6 | import { Chalk } from 'chalk'; 7 | 8 | /** 9 | * @typedef {{ 10 | * lpLanguageId: string, 11 | * lpLanguageName: string, 12 | * lpLocalizedLanguageName: string, 13 | * isCustomization: boolean 14 | * } & import('./index.js').ExtensionConfig} ExtensionConfig 15 | */ 16 | 17 | const chalk = new Chalk(); 18 | 19 | /** 20 | * @type {import('./index.js').ExtensionGenerator} 21 | */ 22 | export default { 23 | id: 'ext-localization', 24 | aliases: ['localization'], 25 | name: 'New Language Pack (Localization)', 26 | /** 27 | * @param {Generator} generator 28 | * @param {ExtensionConfig} extensionConfig 29 | */ 30 | prompting: async (generator, extensionConfig) => { 31 | 32 | await askForLanguageId(generator, extensionConfig); 33 | await askForLanguageName(generator, extensionConfig); 34 | await askForLocalizedLanguageName(generator, extensionConfig); 35 | 36 | await prompts.askForExtensionDisplayName(generator, extensionConfig); 37 | await prompts.askForExtensionId(generator, extensionConfig); 38 | await prompts.askForExtensionDescription(generator, extensionConfig); 39 | 40 | await prompts.askForPackageManager(generator, extensionConfig); 41 | }, 42 | /** 43 | * @param {Generator} generator 44 | * @param {ExtensionConfig} extensionConfig 45 | */ 46 | writing: (generator, extensionConfig) => { 47 | generator.fs.copyTpl(generator.templatePath('package.json'), generator.destinationPath('package.json'), extensionConfig); 48 | generator.fs.copyTpl(generator.templatePath('vsc-extension-quickstart.md'), generator.destinationPath('vsc-extension-quickstart.md'), extensionConfig); 49 | generator.fs.copyTpl(generator.templatePath('README.md'), generator.destinationPath('README.md'), extensionConfig); 50 | generator.fs.copyTpl(generator.templatePath('CHANGELOG.md'), generator.destinationPath('CHANGELOG.md'), extensionConfig); 51 | generator.fs.copy(generator.templatePath('.vscodeignore'), generator.destinationPath('.vscodeignore')); 52 | generator.fs.copy(generator.templatePath('gitignore'), generator.destinationPath('.gitignore')); 53 | generator.fs.copy(generator.templatePath('.gitattributes'), generator.destinationPath('.gitattributes')); 54 | 55 | if (extensionConfig.pkgManager === 'yarn') { 56 | generator.fs.copyTpl(generator.templatePath('.yarnrc'), generator.destinationPath('.yarnrc'), extensionConfig); 57 | } else if (extensionConfig.pkgManager === 'pnpm') { 58 | generator.fs.copyTpl(generator.templatePath('.npmrc-pnpm'), generator.destinationPath('.npmrc'), extensionConfig); 59 | } 60 | 61 | extensionConfig.installDependencies = true; 62 | }, 63 | 64 | endMessage: (generator, extensionConfig) => { 65 | generator.log(chalk.yellow('Please review the "extensionPack" in the "package.json" before publishing the extension pack.')); 66 | generator.log(''); 67 | } 68 | } 69 | 70 | /** 71 | * @param {Generator} generator 72 | * @param {ExtensionConfig} extensionConfig 73 | */ 74 | function askForLanguageId(generator, extensionConfig) { 75 | extensionConfig.isCustomization = true; 76 | generator.log("Enter the language identifier as used on transifex (e.g. bg, zh-Hant)."); 77 | return generator.prompt({ 78 | type: 'input', 79 | name: 'lpLanguageId', 80 | message: 'Language id:', 81 | }).then(answer => { 82 | extensionConfig.lpLanguageId = answer.lpLanguageId; 83 | if (!generator.options['extensionId']) { 84 | generator.options['extensionId'] = "vscode-language-pack-" + answer.lpLanguageId; 85 | } 86 | return Promise.resolve(); 87 | }); 88 | } 89 | 90 | /** 91 | * @param {Generator} generator 92 | * @param {ExtensionConfig} extensionConfig 93 | */ 94 | function askForLanguageName(generator, extensionConfig) { 95 | extensionConfig.isCustomization = true; 96 | generator.log("Enter the language name in English (e.g. 'Bulgarian', 'Dutch')."); 97 | return generator.prompt({ 98 | type: 'input', 99 | name: 'lpLanguageName', 100 | message: 'Language name:', 101 | }).then(answer => { 102 | extensionConfig.lpLanguageName = answer.lpLanguageName; 103 | if (!generator.options['extensionDisplayName']) { 104 | generator.options['extensionDisplayName'] = answer.lpLanguageName + " Language Pack"; 105 | } 106 | if (!generator.options['extensionDescription']) { 107 | generator.options['extensionDescription'] = "Language pack extension for " + answer.lpLanguageName; 108 | } 109 | return Promise.resolve(); 110 | }); 111 | } 112 | 113 | /** 114 | * @param {Generator} generator 115 | * @param {ExtensionConfig} extensionConfig 116 | */ 117 | function askForLocalizedLanguageName(generator, extensionConfig) { 118 | extensionConfig.isCustomization = true; 119 | generator.log("Enter the language name in " + extensionConfig.lpLanguageName); 120 | return generator.prompt({ 121 | type: 'input', 122 | name: 'lpLocalizedLanguageName', 123 | message: 'Localized language name:', 124 | }).then(answer => { 125 | extensionConfig.lpLocalizedLanguageName = answer.lpLocalizedLanguageName; 126 | return Promise.resolve(); 127 | }); 128 | } -------------------------------------------------------------------------------- /generators/app/generate-notebook-renderer.js: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------- 2 | * Copyright (C) Microsoft Corporation. All rights reserved. 3 | *--------------------------------------------------------*/ 4 | import Generator from 'yeoman-generator'; 5 | import * as prompts from './prompts.js'; 6 | 7 | /** 8 | * @typedef {import('./index.js').ExtensionConfig} ExtensionConfig 9 | */ 10 | 11 | /** 12 | * @type {import('./index.js').ExtensionGenerator} 13 | */ 14 | export default { 15 | id: 'ext-notebook-renderer', 16 | aliases: ['notebook'], 17 | name: 'New Notebook Renderer (TypeScript)', 18 | /** 19 | * @param {Generator} generator 20 | * @param {ExtensionConfig} extensionConfig 21 | */ 22 | prompting: async (generator, extensionConfig) => { 23 | await prompts.askForExtensionDisplayName(generator, extensionConfig); 24 | await prompts.askForExtensionId(generator, extensionConfig); 25 | await prompts.askForExtensionDescription(generator, extensionConfig); 26 | 27 | await askForNotebookRendererInfo(generator, extensionConfig); 28 | 29 | await prompts.askForGit(generator, extensionConfig); 30 | await prompts.askForPackageManager(generator, extensionConfig); 31 | 32 | }, 33 | /** 34 | * @param {Generator} generator 35 | * @param {ExtensionConfig} extensionConfig 36 | */ 37 | writing: (generator, extensionConfig) => { 38 | 39 | generator.fs.copy(generator.templatePath('src'), generator.destinationPath('src')); 40 | generator.fs.copy(generator.templatePath('vscode'), generator.destinationPath('.vscode')); 41 | generator.fs.copy(generator.templatePath('tsconfig.json'), generator.destinationPath('tsconfig.json')); 42 | generator.fs.copy(generator.templatePath('.vscodeignore'), generator.destinationPath('.vscodeignore')); 43 | generator.fs.copy(generator.templatePath('webpack.config.js'), generator.destinationPath('webpack.config.js')); 44 | generator.fs.copy(generator.templatePath('eslint.config.mjs'), generator.destinationPath('eslint.config.mjs')); 45 | generator.fs.copy(generator.templatePath('.vscode-test.mjs'), generator.destinationPath('.vscode-test.mjs')); 46 | 47 | generator.fs.copyTpl(generator.templatePath('package.json'), generator.destinationPath('package.json'), extensionConfig); 48 | generator.fs.copyTpl(generator.templatePath('README.md'), generator.destinationPath('README.md'), extensionConfig); 49 | generator.fs.copyTpl(generator.templatePath('CHANGELOG.md'), generator.destinationPath('CHANGELOG.md'), extensionConfig); 50 | generator.fs.copyTpl(generator.templatePath('example/notebook.ipynb'), generator.destinationPath('example/notebook.ipynb'), extensionConfig); 51 | generator.fs.copyTpl(generator.templatePath('src/client/index.ts'), generator.destinationPath('src/client/index.ts'), extensionConfig); 52 | 53 | generator.fs.copyTpl(generator.templatePath('src/extension/extension.ts'), generator.destinationPath('src/extension/extension.ts'), extensionConfig); 54 | 55 | if (extensionConfig.gitInit) { 56 | generator.fs.copy(generator.templatePath('gitignore'), generator.destinationPath('.gitignore')); 57 | generator.fs.copy(generator.templatePath('.gitattributes'), generator.destinationPath('.gitattributes')); 58 | } 59 | 60 | if (extensionConfig.pkgManager === 'yarn') { 61 | generator.fs.copyTpl(generator.templatePath('.yarnrc'), generator.destinationPath('.yarnrc'), extensionConfig); 62 | } else if (extensionConfig.pkgManager === 'pnpm') { 63 | generator.fs.copyTpl(generator.templatePath('.npmrc-pnpm'), generator.destinationPath('.npmrc'), extensionConfig); 64 | } 65 | 66 | extensionConfig.installDependencies = true; 67 | } 68 | } 69 | 70 | /** 71 | * @param {Generator} generator 72 | * @param {ExtensionConfig} extensionConfig 73 | */ 74 | async function askForNotebookRendererInfo(generator, extensionConfig) { 75 | const answers = await generator.prompt([ 76 | { 77 | type: 'input', 78 | name: 'rendererId', 79 | message: 'What\'s the ID for your renderer?', 80 | default: extensionConfig.name 81 | }, 82 | { 83 | type: 'input', 84 | name: 'rendererDisplayName', 85 | message: 'What\'s your renderer display name?', 86 | default: extensionConfig.displayName 87 | }, 88 | { 89 | type: 'input', 90 | name: 'rendererMimeTypes', 91 | message: 'What mime types will your renderer handle? (separate multiple by commas)', 92 | default: 'x-application/custom-json-output', 93 | }, 94 | ]); 95 | 96 | answers.rendererMimeTypes = answers.rendererMimeTypes.split(/,\s*/g); 97 | Object.assign(extensionConfig, answers); 98 | } 99 | -------------------------------------------------------------------------------- /generators/app/prompts.js: -------------------------------------------------------------------------------- 1 | 2 | /*--------------------------------------------------------- 3 | * Copyright (C) Microsoft Corporation. All rights reserved. 4 | *--------------------------------------------------------*/ 5 | 6 | import Generator from 'yeoman-generator'; 7 | 8 | import * as validator from './validator.js'; 9 | import * as path from 'path'; 10 | 11 | /** 12 | * @typedef {import('./index.js').ExtensionConfig} ExtensionConfig 13 | */ 14 | 15 | /** 16 | * @param {Generator} generator 17 | * @param {ExtensionConfig} extensionConfig 18 | */ 19 | export function askForExtensionDisplayName(generator, extensionConfig) { 20 | let extensionDisplayName = generator.options['extensionDisplayName']; 21 | if (extensionDisplayName) { 22 | extensionConfig.displayName = extensionDisplayName; 23 | return Promise.resolve(); 24 | } 25 | const nameFromFolder = generator.options['destination'] ? path.basename(generator.destinationPath()) : ''; 26 | 27 | if (generator.options['quick'] && nameFromFolder) { 28 | extensionConfig.displayName = nameFromFolder; 29 | return Promise.resolve(); 30 | } 31 | 32 | return generator.prompt({ 33 | type: 'input', 34 | name: 'displayName', 35 | message: 'What\'s the name of your extension?', 36 | default: nameFromFolder 37 | }).then(displayNameAnswer => { 38 | extensionConfig.displayName = displayNameAnswer.displayName; 39 | }); 40 | } 41 | 42 | /** 43 | * Ask for extension id ("name" in package.json) 44 | * @param {Generator} generator 45 | * @param {ExtensionConfig} extensionConfig 46 | */ 47 | export function askForExtensionId(generator, extensionConfig) { 48 | const extensionName = generator.options['extensionId']; 49 | if (extensionName) { 50 | extensionConfig.name = extensionName; 51 | return Promise.resolve(); 52 | } 53 | let def = extensionConfig.name; 54 | if (!def && extensionConfig.displayName) { 55 | def = extensionConfig.displayName.toLowerCase().replace(/[^a-z0-9]/g, '-'); 56 | } 57 | if (def && generator.options['quick']) { 58 | extensionConfig.name = def; 59 | return Promise.resolve(); 60 | } 61 | 62 | return generator.prompt({ 63 | type: 'input', 64 | name: 'name', 65 | message: 'What\'s the identifier of your extension?', 66 | default: def || '', 67 | validate: validator.validateExtensionId 68 | }).then(nameAnswer => { 69 | extensionConfig.name = nameAnswer.name; 70 | }); 71 | } 72 | 73 | /** 74 | * Ask for extension description 75 | * @param {Generator} generator 76 | * @param {ExtensionConfig} extensionConfig 77 | */ 78 | export function askForExtensionDescription(generator, extensionConfig) { 79 | const extensionDescription = generator.options['extensionDescription']; 80 | if (extensionDescription) { 81 | extensionConfig.description = extensionDescription; 82 | return Promise.resolve(); 83 | } 84 | if (generator.options['quick']) { 85 | extensionConfig.description = ''; 86 | return Promise.resolve(); 87 | } 88 | 89 | return generator.prompt({ 90 | type: 'input', 91 | name: 'description', 92 | message: 'What\'s the description of your extension?', 93 | default: '' 94 | }).then(descriptionAnswer => { 95 | extensionConfig.description = descriptionAnswer.description; 96 | }); 97 | } 98 | 99 | /** 100 | * @param {Generator} generator 101 | * @param {ExtensionConfig} extensionConfig 102 | */ 103 | export function askForGit(generator, extensionConfig) { 104 | const gitInit = generator.options['gitInit']; 105 | if (typeof gitInit === 'boolean') { 106 | extensionConfig.gitInit = Boolean(gitInit); 107 | return Promise.resolve(); 108 | } 109 | if (generator.options['quick']) { 110 | extensionConfig.gitInit = true; 111 | return Promise.resolve(); 112 | } 113 | 114 | return generator.prompt({ 115 | type: 'confirm', 116 | name: 'gitInit', 117 | message: 'Initialize a git repository?', 118 | default: true 119 | }).then(gitAnswer => { 120 | extensionConfig.gitInit = gitAnswer.gitInit; 121 | }); 122 | } 123 | 124 | /** 125 | * @param {Generator} generator 126 | * @param {ExtensionConfig} extensionConfig 127 | */ 128 | export function askForPackageManager(generator, extensionConfig) { 129 | const pkgManager = generator.options['pkgManager']; 130 | if (pkgManager === 'npm' || pkgManager === 'yarn' || pkgManager === 'pnpm') { 131 | extensionConfig.pkgManager = pkgManager; 132 | return Promise.resolve(); 133 | } 134 | 135 | extensionConfig.pkgManager = 'npm'; 136 | if (generator.options['quick']) { 137 | return Promise.resolve(); 138 | } 139 | 140 | 141 | return generator.prompt({ 142 | type: 'list', 143 | name: 'pkgManager', 144 | message: 'Which package manager to use?', 145 | choices: [ 146 | { 147 | name: 'npm', 148 | value: 'npm' 149 | }, 150 | { 151 | name: 'yarn', 152 | value: 'yarn' 153 | }, 154 | { 155 | name: 'pnpm', 156 | value: 'pnpm' 157 | } 158 | ] 159 | }).then(pckgManagerAnswer => { 160 | extensionConfig.pkgManager = pckgManagerAnswer.pkgManager; 161 | }); 162 | } 163 | 164 | /** 165 | * @param {Generator} generator 166 | * @param {ExtensionConfig} extensionConfig 167 | * @param {'webpack' | 'esbuild' | 'unbundled'} defaultBundler 168 | */ 169 | export function askForBundler(generator, extensionConfig, allowNone = true, defaultBundler = 'unbundled') { 170 | const bundler = generator.options['bundler']; 171 | if (bundler === 'webpack' || bundler === 'esbuild') { 172 | extensionConfig.bundler = bundler; 173 | return Promise.resolve(); 174 | } 175 | const webpack = generator.options['webpack']; // backwards compatibility 176 | if (typeof webpack === 'boolean' && webpack) { 177 | extensionConfig.bundler = 'webpack'; 178 | return Promise.resolve(); 179 | } 180 | if (generator.options['quick']) { 181 | extensionConfig.bundler = defaultBundler; 182 | return Promise.resolve(); 183 | } 184 | 185 | const choices = allowNone ? [{ name: 'unbundled', value: 'unbundled' }] : []; 186 | 187 | return generator.prompt({ 188 | type: 'list', 189 | default: defaultBundler, 190 | name: 'bundler', 191 | message: 'Which bundler to use?', 192 | choices: [ 193 | ...choices, 194 | { 195 | name: 'webpack', 196 | value: 'webpack' 197 | }, 198 | { 199 | name: 'esbuild', 200 | value: 'esbuild' 201 | } 202 | ] 203 | }).then(bundlerAnswer => { 204 | extensionConfig.bundler = bundlerAnswer.bundler; 205 | }); 206 | } 207 | -------------------------------------------------------------------------------- /generators/app/templates/ext-colortheme/.gitattributes: -------------------------------------------------------------------------------- 1 | # Set default behavior to automatically normalize line endings. 2 | * text=auto 3 | -------------------------------------------------------------------------------- /generators/app/templates/ext-colortheme/.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | .gitignore 4 | vsc-extension-quickstart.md 5 | -------------------------------------------------------------------------------- /generators/app/templates/ext-colortheme/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to the "<%= name %>" extension will be documented in this file. 4 | 5 | Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. 6 | 7 | ## [Unreleased] 8 | 9 | - Initial release 10 | -------------------------------------------------------------------------------- /generators/app/templates/ext-colortheme/README.md: -------------------------------------------------------------------------------- 1 | # <%- name %> README 2 | 3 | ## Working with Markdown 4 | 5 | You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts: 6 | 7 | * Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux). 8 | * Toggle preview (`Shift+Cmd+V` on macOS or `Shift+Ctrl+V` on Windows and Linux). 9 | * Press `Ctrl+Space` (Windows, Linux, macOS) to see a list of Markdown snippets. 10 | 11 | ## For more information 12 | 13 | * [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown) 14 | * [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/) 15 | 16 | **Enjoy!** 17 | -------------------------------------------------------------------------------- /generators/app/templates/ext-colortheme/gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.vsix 3 | .env 4 | -------------------------------------------------------------------------------- /generators/app/templates/ext-colortheme/package.json: -------------------------------------------------------------------------------- 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 | "Themes" 11 | ], 12 | "contributes": { 13 | "themes": [ 14 | { 15 | "label": <%- JSON.stringify(themeName) %>, 16 | "uiTheme": <%- JSON.stringify(themeBase) %>, 17 | "path": <%- JSON.stringify("./themes/" + themeFileName) %> 18 | } 19 | ] 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /generators/app/templates/ext-colortheme/themes/color-theme.json: -------------------------------------------------------------------------------- 1 | <%-JSON.stringify(themeContent, null, '\t')%> -------------------------------------------------------------------------------- /generators/app/templates/ext-colortheme/themes/theme.tmTheme: -------------------------------------------------------------------------------- 1 | <%- tmThemeContent %> -------------------------------------------------------------------------------- /generators/app/templates/ext-colortheme/vsc-extension-quickstart.md: -------------------------------------------------------------------------------- 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 color theme extension. 6 | * `package.json` - this is the manifest file that defines the location of the theme file and specifies the base theme of the theme. 7 | * `themes/<%= themeFileName %>` - the color theme definition file. 8 | 9 | ## Get up and running straight away 10 | 11 | * Press `F5` to open a new window with your extension loaded. 12 | * Open the color theme picker with the `File > Preferences > Theme > Color Theme` menu item, or use the `Preferences: Color Theme command (Ctrl+K Ctrl+T)` and pick your theme 13 | * Open a file that has a language associated. The languages' configured grammar will tokenize the text and assign 'scopes' to the tokens. To examine these scopes, invoke the `Developer: Inspect Editor Tokens and Scopes` command from the Command Palette (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac). 14 | 15 | ## Make changes 16 | 17 | * Changes to the theme file are automatically applied to the Extension Development Host window. 18 | 19 | ## Adopt your theme to Visual Studio Code 20 | 21 | * The token colorization is done based on standard TextMate themes. Colors are matched against one or more scopes. 22 | 23 | To learn more about scopes and how they're used, check out the [color theme](https://code.visualstudio.com/api/extension-guides/color-theme) documentation. 24 | 25 | ## Install your extension 26 | 27 | * To start using your extension with Visual Studio Code copy it into the `/.vscode/extensions` folder and restart Code. 28 | * To share your extension with the world, read on https://code.visualstudio.com/api/working-with-extensions/publishing-extension about publishing an extension. 29 | -------------------------------------------------------------------------------- /generators/app/templates/ext-colortheme/vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that launches the extension 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": "Extension", 10 | "type": "extensionHost", 11 | "request": "launch", 12 | "args": [ 13 | "--extensionDevelopmentPath=${workspaceFolder}" 14 | ] 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-js/.npmrc-pnpm: -------------------------------------------------------------------------------- 1 | enable-pre-post-scripts = true -------------------------------------------------------------------------------- /generators/app/templates/ext-command-js/.vscode-test.mjs: -------------------------------------------------------------------------------- 1 | import { defineConfig } from '@vscode/test-cli'; 2 | 3 | export default defineConfig({ 4 | files: 'test/**/*.test.js', 5 | }); 6 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-js/.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | test/** 4 | .gitignore 5 | .yarnrc 6 | vsc-extension-quickstart.md 7 | **/jsconfig.json 8 | **/*.map 9 | **/eslint.config.mjs 10 | **/.vscode-test.* 11 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-js/.yarnrc: -------------------------------------------------------------------------------- 1 | --ignore-engines true -------------------------------------------------------------------------------- /generators/app/templates/ext-command-js/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to the "<%= name %>" extension will be documented in this file. 4 | 5 | Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. 6 | 7 | ## [Unreleased] 8 | 9 | - Initial release -------------------------------------------------------------------------------- /generators/app/templates/ext-command-js/README.md: -------------------------------------------------------------------------------- 1 | # <%= name %> README 2 | 3 | This is the README for your extension "<%= name %>". After writing up a brief description, we recommend including the following sections. 4 | 5 | ## Features 6 | 7 | Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file. 8 | 9 | For example if there is an image subfolder under your extension project workspace: 10 | 11 | \!\[feature X\]\(images/feature-x.png\) 12 | 13 | > Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow. 14 | 15 | ## Requirements 16 | 17 | If you have any requirements or dependencies, add a section describing those and how to install and configure them. 18 | 19 | ## Extension Settings 20 | 21 | Include if your extension adds any VS Code settings through the `contributes.configuration` extension point. 22 | 23 | For example: 24 | 25 | This extension contributes the following settings: 26 | 27 | * `myExtension.enable`: Enable/disable this extension. 28 | * `myExtension.thing`: Set to `blah` to do something. 29 | 30 | ## Known Issues 31 | 32 | Calling out known issues can help limit users opening duplicate issues against your extension. 33 | 34 | ## Release Notes 35 | 36 | Users appreciate release notes as you update your extension. 37 | 38 | ### 1.0.0 39 | 40 | Initial release of ... 41 | 42 | ### 1.0.1 43 | 44 | Fixed issue #. 45 | 46 | ### 1.1.0 47 | 48 | Added features X, Y, and Z. 49 | 50 | --- 51 | 52 | ## Working with Markdown 53 | 54 | You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts: 55 | 56 | * Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux) 57 | * Toggle preview (`Shift+Cmd+V` on macOS or `Shift+Ctrl+V` on Windows and Linux) 58 | * Press `Ctrl+Space` (Windows, Linux, macOS) to see a list of Markdown snippets 59 | 60 | ## For more information 61 | 62 | * [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown) 63 | * [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/) 64 | 65 | **Enjoy!** 66 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-js/eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import globals from "globals"; 2 | 3 | export default [{ 4 | files: ["**/*.js"], 5 | languageOptions: { 6 | globals: { 7 | ...globals.commonjs, 8 | ...globals.node, 9 | ...globals.mocha, 10 | }, 11 | 12 | ecmaVersion: 2022, 13 | sourceType: "module", 14 | }, 15 | 16 | rules: { 17 | "no-const-assign": "warn", 18 | "no-this-before-super": "warn", 19 | "no-undef": "warn", 20 | "no-unreachable": "warn", 21 | "no-unused-vars": "warn", 22 | "constructor-super": "warn", 23 | "valid-typeof": "warn", 24 | }, 25 | }]; -------------------------------------------------------------------------------- /generators/app/templates/ext-command-js/extension.js: -------------------------------------------------------------------------------- 1 | // The module 'vscode' contains the VS Code extensibility API 2 | // Import the module and reference it with the alias vscode in your code below 3 | const vscode = require('vscode'); 4 | 5 | // This method is called when your extension is activated 6 | // Your extension is activated the very first time the command is executed 7 | 8 | /** 9 | * @param {vscode.ExtensionContext} context 10 | */ 11 | function activate(context) { 12 | 13 | // Use the console to output diagnostic information (console.log) and errors (console.error) 14 | // This line of code will only be executed once when your extension is activated 15 | console.log('Congratulations, your extension "<%= name %>" is now active!'); 16 | 17 | // The command has been defined in the package.json file 18 | // Now provide the implementation of the command with registerCommand 19 | // The commandId parameter must match the command field in package.json 20 | const disposable = vscode.commands.registerCommand('<%= name %>.helloWorld', function () { 21 | // The code you place here will be executed every time your command is executed 22 | 23 | // Display a message box to the user 24 | vscode.window.showInformationMessage('Hello World from <%= displayName %>!'); 25 | }); 26 | 27 | context.subscriptions.push(disposable); 28 | } 29 | 30 | // This method is called when your extension is deactivated 31 | function deactivate() {} 32 | 33 | module.exports = { 34 | activate, 35 | deactivate 36 | } 37 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-js/gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .vscode-test/ 3 | *.vsix 4 | .env 5 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-js/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "Node16", 4 | "target": "ES2022", 5 | "checkJs": <%- JSON.stringify(checkJavaScript) %>, /* Typecheck .js files. */ 6 | "lib": [ 7 | "ES2022" 8 | ] 9 | }, 10 | "exclude": [ 11 | "node_modules" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-js/package.json: -------------------------------------------------------------------------------- 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": "./extension.js", 14 | "contributes": { 15 | "commands": [{ 16 | "command": <%- JSON.stringify(`${name}.helloWorld`) %>, 17 | "title": "Hello World" 18 | }] 19 | }, 20 | "scripts": { 21 | "lint": "eslint .", 22 | "pretest": "<%= pkgManager %> run lint", 23 | "test": "vscode-test" 24 | }, 25 | "devDependencies": { 26 | <%- dep("@types/vscode") %>, 27 | <%- dep("@types/mocha") %>, 28 | <%- dep("@types/node") %>, 29 | <%- dep("eslint") %>, 30 | <%- dep("@vscode/test-cli") %>, 31 | <%- dep("@vscode/test-electron") %> 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-js/test/extension.test.js: -------------------------------------------------------------------------------- 1 | const assert = require('assert'); 2 | 3 | // You can import and use all API from the 'vscode' module 4 | // as well as import your extension to test it 5 | const vscode = require('vscode'); 6 | // const myExtension = require('../extension'); 7 | 8 | suite('Extension Test Suite', () => { 9 | vscode.window.showInformationMessage('Start all tests.'); 10 | 11 | test('Sample test', () => { 12 | assert.strictEqual(-1, [1, 2, 3].indexOf(5)); 13 | assert.strictEqual(-1, [1, 2, 3].indexOf(0)); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-js/vsc-extension-quickstart.md: -------------------------------------------------------------------------------- 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 | * `extension.js` - 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 | ## Get up and running straight away 13 | 14 | * Press `F5` to open a new window with your extension loaded. 15 | * Run your command from the command palette by pressing (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and typing `Hello World`. 16 | * Set breakpoints in your code inside `extension.js` to debug your extension. 17 | * Find output from your extension in the debug console. 18 | 19 | ## Make changes 20 | 21 | * You can relaunch the extension from the debug toolbar after changing code in `extension.js`. 22 | * You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes. 23 | 24 | ## Explore the API 25 | 26 | * You can open the full set of our API when you open the file `node_modules/@types/vscode/index.d.ts`. 27 | 28 | ## Run tests 29 | 30 | * Install the [Extension Test Runner](https://marketplace.visualstudio.com/items?itemName=ms-vscode.extension-test-runner) 31 | * Open the Testing view from the activity bar and click the Run Test" button, or use the hotkey `Ctrl/Cmd + ; A` 32 | * See the output of the test result in the Test Results view. 33 | * Make changes to `test/extension.test.js` or create new test files inside the `test` folder. 34 | * The provided test runner will only consider files matching the name pattern `**.test.js`. 35 | * You can create folders inside the `test` folder to structure your tests any way you want. 36 | 37 | ## Go further 38 | 39 | * [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. 40 | * [Publish your extension](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) on the VS Code extension marketplace. 41 | * Automate builds by setting up [Continuous Integration](https://code.visualstudio.com/api/working-with-extensions/continuous-integration). 42 | * Integrate to the [report issue](https://code.visualstudio.com/api/get-started/wrapping-up#issue-reporting) flow to get issue and feature requests reported by users. 43 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-js/vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "dbaeumer.vscode-eslint", 6 | "ms-vscode.extension-test-runner" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-js/vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that launches the extension 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 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/.npmrc-pnpm: -------------------------------------------------------------------------------- 1 | enable-pre-post-scripts = true -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/.vscode-test.mjs: -------------------------------------------------------------------------------- 1 | import { defineConfig } from '@vscode/test-cli'; 2 | 3 | export default defineConfig({ 4 | files: 'out/test/**/*.test.js', 5 | }); 6 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | src/** 4 | .gitignore 5 | .yarnrc 6 | vsc-extension-quickstart.md 7 | **/tsconfig.json 8 | **/eslint.config.mjs 9 | **/*.map 10 | **/*.ts 11 | **/.vscode-test.* 12 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/.yarnrc: -------------------------------------------------------------------------------- 1 | --ignore-engines true -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to the "<%= name %>" extension will be documented in this file. 4 | 5 | Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. 6 | 7 | ## [Unreleased] 8 | 9 | - Initial release -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/README.md: -------------------------------------------------------------------------------- 1 | # <%= name %> README 2 | 3 | This is the README for your extension "<%= name %>". After writing up a brief description, we recommend including the following sections. 4 | 5 | ## Features 6 | 7 | Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file. 8 | 9 | For example if there is an image subfolder under your extension project workspace: 10 | 11 | \!\[feature X\]\(images/feature-x.png\) 12 | 13 | > Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow. 14 | 15 | ## Requirements 16 | 17 | If you have any requirements or dependencies, add a section describing those and how to install and configure them. 18 | 19 | ## Extension Settings 20 | 21 | Include if your extension adds any VS Code settings through the `contributes.configuration` extension point. 22 | 23 | For example: 24 | 25 | This extension contributes the following settings: 26 | 27 | * `myExtension.enable`: Enable/disable this extension. 28 | * `myExtension.thing`: Set to `blah` to do something. 29 | 30 | ## Known Issues 31 | 32 | Calling out known issues can help limit users opening duplicate issues against your extension. 33 | 34 | ## Release Notes 35 | 36 | Users appreciate release notes as you update your extension. 37 | 38 | ### 1.0.0 39 | 40 | Initial release of ... 41 | 42 | ### 1.0.1 43 | 44 | Fixed issue #. 45 | 46 | ### 1.1.0 47 | 48 | Added features X, Y, and Z. 49 | 50 | --- 51 | 52 | ## Following extension guidelines 53 | 54 | Ensure that you've read through the extensions guidelines and follow the best practices for creating your extension. 55 | 56 | * [Extension Guidelines](https://code.visualstudio.com/api/references/extension-guidelines) 57 | 58 | ## Working with Markdown 59 | 60 | You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts: 61 | 62 | * Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux). 63 | * Toggle preview (`Shift+Cmd+V` on macOS or `Shift+Ctrl+V` on Windows and Linux). 64 | * Press `Ctrl+Space` (Windows, Linux, macOS) to see a list of Markdown snippets. 65 | 66 | ## For more information 67 | 68 | * [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown) 69 | * [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/) 70 | 71 | **Enjoy!** 72 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import typescriptEslint from "@typescript-eslint/eslint-plugin"; 2 | import tsParser from "@typescript-eslint/parser"; 3 | 4 | export default [{ 5 | files: ["**/*.ts"], 6 | }, { 7 | plugins: { 8 | "@typescript-eslint": typescriptEslint, 9 | }, 10 | 11 | languageOptions: { 12 | parser: tsParser, 13 | ecmaVersion: 2022, 14 | sourceType: "module", 15 | }, 16 | 17 | rules: { 18 | "@typescript-eslint/naming-convention": ["warn", { 19 | selector: "import", 20 | format: ["camelCase", "PascalCase"], 21 | }], 22 | 23 | curly: "warn", 24 | eqeqeq: "warn", 25 | "no-throw-literal": "warn", 26 | semi: "warn", 27 | }, 28 | }]; -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/gitignore: -------------------------------------------------------------------------------- 1 | out 2 | dist 3 | node_modules 4 | .vscode-test/ 5 | *.vsix 6 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/package.json: -------------------------------------------------------------------------------- 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": "./out/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 compile", 25 | "compile": "tsc -p ./", 26 | "watch": "tsc -watch -p ./", 27 | "pretest": "<%= pkgManager %> run compile && <%= pkgManager %> run lint", 28 | "lint": "eslint src", 29 | "test": "vscode-test"<% if (insiders) { %>, 30 | "update-proposed-api": "vscode-dts dev"<% } %> 31 | }, 32 | "devDependencies": { 33 | <%- dep("@types/vscode") %>, 34 | <%- dep("@types/mocha") %>, 35 | <%- dep("@types/node") %>, 36 | <%- dep("@typescript-eslint/eslint-plugin") %>, 37 | <%- dep("@typescript-eslint/parser") %>, 38 | <%- dep("eslint") %>, 39 | <%- dep("typescript") %>, 40 | <%- dep("@vscode/test-cli") %>, 41 | <%- dep("@vscode/test-electron") %><% if (insiders) { %>, 42 | <%- dep("vscode-dts") %><% } %> 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/src/extension.ts: -------------------------------------------------------------------------------- 1 | // The module 'vscode' contains the VS Code extensibility API 2 | // Import the module and reference it with the alias vscode in your code below 3 | import * as vscode from 'vscode'; 4 | 5 | // This method is called when your extension is activated 6 | // Your extension is activated the very first time the command is executed 7 | export function activate(context: vscode.ExtensionContext) { 8 | 9 | // Use the console to output diagnostic information (console.log) and errors (console.error) 10 | // This line of code will only be executed once when your extension is activated 11 | console.log('Congratulations, your extension "<%= name %>" is now active!'); 12 | 13 | // The command has been defined in the package.json file 14 | // Now provide the implementation of the command with registerCommand 15 | // The commandId parameter must match the command field in package.json 16 | const disposable = vscode.commands.registerCommand('<%= name %>.helloWorld', () => { 17 | // The code you place here will be executed every time your command is executed 18 | // Display a message box to the user 19 | vscode.window.showInformationMessage('Hello World from <%= displayName %>!'); 20 | }); 21 | 22 | context.subscriptions.push(disposable); 23 | } 24 | 25 | // This method is called when your extension is deactivated 26 | export function deactivate() {} 27 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/src/test/extension.test.ts: -------------------------------------------------------------------------------- 1 | import * as assert from 'assert'; 2 | 3 | // You can import and use all API from the 'vscode' module 4 | // as well as import your extension to test it 5 | import * as vscode from 'vscode'; 6 | // import * as myExtension from '../../extension'; 7 | 8 | suite('Extension Test Suite', () => { 9 | vscode.window.showInformationMessage('Start all tests.'); 10 | 11 | test('Sample test', () => { 12 | assert.strictEqual(-1, [1, 2, 3].indexOf(5)); 13 | assert.strictEqual(-1, [1, 2, 3].indexOf(0)); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "Node16", 4 | "target": "ES2022", 5 | "outDir": "out", 6 | "lib": [ 7 | "ES2022" 8 | ], 9 | "sourceMap": true, 10 | "rootDir": "src", 11 | "strict": true, /* enable all strict type-checking options */ 12 | /* Additional Checks */ 13 | // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ 14 | // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ 15 | // "noUnusedParameters": true, /* Report errors on unused parameters. */ 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/vsc-extension-quickstart.md: -------------------------------------------------------------------------------- 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 | ## Get up and running straight away 13 | 14 | * Press `F5` to open a new window with your extension loaded. 15 | * Run your command from the command palette by pressing (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and typing `Hello World`. 16 | * Set breakpoints in your code inside `src/extension.ts` to debug your extension. 17 | * Find output from your extension in the debug console. 18 | 19 | ## Make changes 20 | 21 | * You can relaunch the extension from the debug toolbar after changing code in `src/extension.ts`. 22 | * You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes. 23 | 24 | ## Explore the API 25 | 26 | * You can open the full set of our API when you open the file `node_modules/@types/vscode/index.d.ts`. 27 | 28 | ## Run tests 29 | 30 | * Install the [Extension Test Runner](https://marketplace.visualstudio.com/items?itemName=ms-vscode.extension-test-runner) 31 | * Run the "watch" task via the **Tasks: Run Task** command. Make sure this is running, or tests might not be discovered. 32 | * Open the Testing view from the activity bar and click the Run Test" button, or use the hotkey `Ctrl/Cmd + ; A` 33 | * See the output of the test result in the Test Results view. 34 | * Make changes to `src/test/extension.test.ts` or create new test files inside the `test` folder. 35 | * The provided test runner will only consider files matching the name pattern `**.test.ts`. 36 | * You can create folders inside the `test` folder to structure your tests any way you want. 37 | 38 | ## Go further 39 | 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 | * 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). 44 | * Integrate to the [report issue](https://code.visualstudio.com/api/get-started/wrapping-up#issue-reporting) flow to get issue and feature requests reported by users. 45 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/vscode-esbuild/.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | out/** 4 | node_modules/** 5 | src/** 6 | .gitignore 7 | .yarnrc 8 | esbuild.js 9 | vsc-extension-quickstart.md 10 | **/tsconfig.json 11 | **/eslint.config.mjs 12 | **/*.map 13 | **/*.ts 14 | **/.vscode-test.* 15 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/vscode-esbuild/esbuild.js: -------------------------------------------------------------------------------- 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 | }); 57 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/vscode-esbuild/package.json: -------------------------------------------------------------------------------- 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", 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 | } 53 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/vscode-esbuild/tsconfig.json: -------------------------------------------------------------------------------- 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 | } 17 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/vscode-esbuild/vsc-extension-quickstart.md: -------------------------------------------------------------------------------- 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). 49 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/vscode-esbuild/vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": ["dbaeumer.vscode-eslint", "connor4312.esbuild-problem-matchers", "ms-vscode.extension-test-runner"] 5 | } 6 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/vscode-esbuild/vscode/launch.json: -------------------------------------------------------------------------------- 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 | } 22 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/vscode-esbuild/vscode/settings.json: -------------------------------------------------------------------------------- 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 | } -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/vscode-esbuild/vscode/tasks.json: -------------------------------------------------------------------------------- 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 | }, 20 | { 21 | "type": "npm", 22 | "script": "watch:esbuild", 23 | "group": "build", 24 | "problemMatcher": "$esbuild-watch", 25 | "isBackground": true, 26 | "label": "npm: watch:esbuild", 27 | "presentation": { 28 | "group": "watch", 29 | "reveal": "never" 30 | } 31 | }, 32 | { 33 | "type": "npm", 34 | "script": "watch:tsc", 35 | "group": "build", 36 | "problemMatcher": "$tsc-watch", 37 | "isBackground": true, 38 | "label": "npm: watch:tsc", 39 | "presentation": { 40 | "group": "watch", 41 | "reveal": "never" 42 | } 43 | }, 44 | { 45 | "type": "npm", 46 | "script": "watch-tests", 47 | "problemMatcher": "$tsc-watch", 48 | "isBackground": true, 49 | "presentation": { 50 | "reveal": "never", 51 | "group": "watchers" 52 | }, 53 | "group": "build" 54 | }, 55 | { 56 | "label": "tasks: watch-tests", 57 | "dependsOn": [ 58 | "npm: watch", 59 | "npm: watch-tests" 60 | ], 61 | "problemMatcher": [] 62 | } 63 | ] 64 | } 65 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/vscode-webpack/.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | out/** 4 | node_modules/** 5 | src/** 6 | .gitignore 7 | .yarnrc 8 | webpack.config.js 9 | vsc-extension-quickstart.md 10 | **/tsconfig.json 11 | **/eslint.config.mjs 12 | **/*.map 13 | **/*.ts 14 | **/.vscode-test.* 15 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/vscode-webpack/package.json: -------------------------------------------------------------------------------- 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": "webpack", 26 | "watch": "webpack --watch", 27 | "package": "webpack --mode production --devtool hidden-source-map", 28 | "compile-tests": "tsc -p . --outDir out", 29 | "watch-tests": "tsc -p . -w --outDir out", 30 | "pretest": "<%= pkgManager %> run compile-tests && <%= pkgManager %> run compile && <%= pkgManager %> run lint", 31 | "lint": "eslint src", 32 | "test": "vscode-test"<% if (insiders) { %>, 33 | "update-proposed-api": "vscode-dts dev"<% } %> 34 | }, 35 | "devDependencies": { 36 | <%- dep("@types/vscode") %>, 37 | <%- dep("@types/mocha") %>, 38 | <%- dep("@types/node") %>, 39 | <%- dep("@typescript-eslint/eslint-plugin") %>, 40 | <%- dep("@typescript-eslint/parser") %>, 41 | <%- dep("eslint") %>, 42 | <%- dep("typescript") %>, 43 | <%- dep("ts-loader") %>, 44 | <%- dep("webpack") %>, 45 | <%- dep("webpack-cli") %>, 46 | <%- dep("@vscode/test-cli") %>, 47 | <%- dep("@vscode/test-electron") %><% if (insiders) { %>, 48 | <%- dep("vscode-dts") %><% } %> 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/vscode-webpack/tsconfig.json: -------------------------------------------------------------------------------- 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 | } 17 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/vscode-webpack/vsc-extension-quickstart.md: -------------------------------------------------------------------------------- 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). 49 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/vscode-webpack/vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": ["dbaeumer.vscode-eslint", "amodio.tsl-problem-matcher", "ms-vscode.extension-test-runner"] 5 | } 6 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/vscode-webpack/vscode/launch.json: -------------------------------------------------------------------------------- 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 | } 22 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/vscode-webpack/vscode/settings.json: -------------------------------------------------------------------------------- 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 | } 14 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/vscode-webpack/vscode/tasks.json: -------------------------------------------------------------------------------- 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 | "type": "npm", 8 | "script": "watch", 9 | "problemMatcher": "$ts-webpack-watch", 10 | "isBackground": true, 11 | "presentation": { 12 | "reveal": "never", 13 | "group": "watchers" 14 | }, 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | } 19 | }, 20 | { 21 | "type": "npm", 22 | "script": "watch-tests", 23 | "problemMatcher": "$tsc-watch", 24 | "isBackground": true, 25 | "presentation": { 26 | "reveal": "never", 27 | "group": "watchers" 28 | }, 29 | "group": "build" 30 | }, 31 | { 32 | "label": "tasks: watch-tests", 33 | "dependsOn": [ 34 | "npm: watch", 35 | "npm: watch-tests" 36 | ], 37 | "problemMatcher": [] 38 | } 39 | ] 40 | } 41 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/vscode-webpack/webpack.config.js: -------------------------------------------------------------------------------- 1 | //@ts-check 2 | 3 | 'use strict'; 4 | 5 | const path = require('path'); 6 | 7 | //@ts-check 8 | /** @typedef {import('webpack').Configuration} WebpackConfig **/ 9 | 10 | /** @type WebpackConfig */ 11 | const extensionConfig = { 12 | target: 'node', // VS Code extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/ 13 | mode: 'none', // this leaves the source code as close as possible to the original (when packaging we set this to 'production') 14 | 15 | entry: './src/extension.ts', // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/ 16 | output: { 17 | // the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/ 18 | path: path.resolve(__dirname, 'dist'), 19 | filename: 'extension.js', 20 | libraryTarget: 'commonjs2' 21 | }, 22 | externals: { 23 | 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/ 24 | // modules added here also need to be added in the .vscodeignore file 25 | }, 26 | resolve: { 27 | // support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader 28 | extensions: ['.ts', '.js'] 29 | }, 30 | module: { 31 | rules: [ 32 | { 33 | test: /\.ts$/, 34 | exclude: /node_modules/, 35 | use: [ 36 | { 37 | loader: 'ts-loader' 38 | } 39 | ] 40 | } 41 | ] 42 | }, 43 | devtool: 'nosources-source-map', 44 | infrastructureLogging: { 45 | level: "log", // enables logging required for problem matchers 46 | }, 47 | }; 48 | module.exports = [ extensionConfig ]; -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "dbaeumer.vscode-eslint", 6 | "ms-vscode.extension-test-runner" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/vscode/launch.json: -------------------------------------------------------------------------------- 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}/out/**/*.js" 17 | ], 18 | "preLaunchTask": "${defaultBuildTask}" 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/vscode/settings.json: -------------------------------------------------------------------------------- 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 | }, 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 | } 12 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-ts/vscode/tasks.json: -------------------------------------------------------------------------------- 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 | "type": "npm", 8 | "script": "watch", 9 | "problemMatcher": "$tsc-watch", 10 | "isBackground": true, 11 | "presentation": { 12 | "reveal": "never" 13 | }, 14 | "group": { 15 | "kind": "build", 16 | "isDefault": true 17 | } 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-web/.npmrc-pnpm: -------------------------------------------------------------------------------- 1 | enable-pre-post-scripts = true -------------------------------------------------------------------------------- /generators/app/templates/ext-command-web/.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test-web/** 3 | src/** 4 | out/** 5 | node_modules/** 6 | dist/**/test/** 7 | .gitignore 8 | vsc-extension-quickstart.md 9 | webpack.config.js 10 | esbuild.js 11 | .yarnrc 12 | **/tsconfig.json 13 | **/eslint.config.mjs 14 | **/*.map 15 | **/*.ts 16 | **/.vscode-test.* 17 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-web/.yarnrc: -------------------------------------------------------------------------------- 1 | --ignore-engines true -------------------------------------------------------------------------------- /generators/app/templates/ext-command-web/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to the "<%= name %>" extension will be documented in this file. 4 | 5 | Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. 6 | 7 | ## [Unreleased] 8 | 9 | - Initial release -------------------------------------------------------------------------------- /generators/app/templates/ext-command-web/README.md: -------------------------------------------------------------------------------- 1 | # <%= name %> README 2 | 3 | This is the README for your extension "<%= name %>". After writing up a brief description, we recommend including the following sections. 4 | 5 | ## Features 6 | 7 | Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file. 8 | 9 | For example if there is an image subfolder under your extension project workspace: 10 | 11 | \!\[feature X\]\(images/feature-x.png\) 12 | 13 | > Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow. 14 | 15 | ## Requirements 16 | 17 | If you have any requirements or dependencies, add a section describing those and how to install and configure them. 18 | 19 | ## Extension Settings 20 | 21 | Include if your extension adds any VS Code settings through the `contributes.configuration` extension point. 22 | 23 | For example: 24 | 25 | This extension contributes the following settings: 26 | 27 | * `myExtension.enable`: Enable/disable this extension. 28 | * `myExtension.thing`: Set to `blah` to do something. 29 | 30 | ## Known Issues 31 | 32 | Calling out known issues can help limit users opening duplicate issues against your extension. 33 | 34 | ## Release Notes 35 | 36 | Users appreciate release notes as you update your extension. 37 | 38 | ### 1.0.0 39 | 40 | Initial release of ... 41 | 42 | ### 1.0.1 43 | 44 | Fixed issue #. 45 | 46 | ### 1.1.0 47 | 48 | Added features X, Y, and Z. 49 | 50 | --- 51 | 52 | ## Working with Markdown 53 | 54 | You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts: 55 | 56 | * Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux). 57 | * Toggle preview (`Shift+Cmd+V` on macOS or `Shift+Ctrl+V` on Windows and Linux). 58 | * Press `Ctrl+Space` (Windows, Linux, macOS) to see a list of Markdown snippets. 59 | 60 | ## For more information 61 | 62 | * [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown) 63 | * [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/) 64 | 65 | **Enjoy!** 66 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-web/esbuild-package.json: -------------------------------------------------------------------------------- 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 | "browser": "./dist/web/extension.js", 14 | "contributes": { 15 | "commands": [ 16 | { 17 | "command": <%- JSON.stringify(`${name}.helloWorld`) %>, 18 | "title": "Hello World" 19 | } 20 | ] 21 | }, 22 | "scripts": { 23 | "test": "vscode-test-web --browserType=chromium --extensionDevelopmentPath=. --extensionTestsPath=dist/web/test/suite/extensionTests.js", 24 | "pretest": "<%= pkgManager %> run compile-web", 25 | "vscode:prepublish": "<%= pkgManager %> run package-web", 26 | "compile-web": "<%= pkgManager %> run check-types && <%= pkgManager %> run lint && node esbuild.js", 27 | "watch-web": "npm-run-all -p watch-web:*", 28 | "watch-web:esbuild": "node esbuild.js --watch", 29 | "watch-web:tsc": "tsc --noEmit --watch --project tsconfig.json", 30 | "package-web": "<%= pkgManager %> run check-types && <%= pkgManager %> run lint && node esbuild.js --production", 31 | "check-types": "tsc --noEmit", 32 | "lint": "eslint src", 33 | "run-in-browser": "vscode-test-web --browserType=chromium --extensionDevelopmentPath=. ." 34 | }, 35 | "devDependencies": { 36 | <%- dep("@types/vscode") %>, 37 | <%- dep("@types/mocha") %>, 38 | <%- dep("@types/assert") %>, 39 | <%- dep("eslint") %>, 40 | <%- dep("@typescript-eslint/eslint-plugin") %>, 41 | <%- dep("@typescript-eslint/parser") %>, 42 | <%- dep("mocha") %>, 43 | <%- dep("typescript") %>, 44 | <%- dep("@vscode/test-web") %>, 45 | <%- dep("esbuild") %>, 46 | <%- dep("glob") %>, 47 | <%- dep("npm-run-all") %>, 48 | <%- dep("@esbuild-plugins/node-globals-polyfill") %>, 49 | <%- dep("assert") %> 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-web/esbuild.js: -------------------------------------------------------------------------------- 1 | const esbuild = require('esbuild'); 2 | const glob = require('glob'); 3 | const path = require('path'); 4 | const polyfill = require('@esbuild-plugins/node-globals-polyfill'); 5 | 6 | const production = process.argv.includes('--production'); 7 | const watch = process.argv.includes('--watch'); 8 | 9 | /** 10 | * This plugin hooks into the build process to print errors in a format that the problem matcher in 11 | * Visual Studio Code can understand. 12 | * @type {import('esbuild').Plugin} 13 | */ 14 | const esbuildProblemMatcherPlugin = { 15 | name: 'esbuild-problem-matcher', 16 | 17 | setup(build) { 18 | build.onStart(() => { 19 | console.log('[watch] build started'); 20 | }); 21 | build.onEnd((result) => { 22 | result.errors.forEach(({ text, location }) => { 23 | console.error(`✘ [ERROR] ${text}`); 24 | console.error(` ${location.file}:${location.line}:${location.column}:`); 25 | }); 26 | console.log('[watch] build finished'); 27 | }); 28 | }, 29 | }; 30 | 31 | 32 | /** 33 | * For web extension, all tests, including the test runner, need to be bundled into 34 | * a single module that has a exported `run` function . 35 | * This plugin bundles implements a virtual file extensionTests.ts that bundles all these together. 36 | * @type {import('esbuild').Plugin} 37 | */ 38 | const testBundlePlugin = { 39 | name: 'testBundlePlugin', 40 | setup(build) { 41 | build.onResolve({ filter: /[\/\\]extensionTests\.ts$/ }, args => { 42 | if (args.kind === 'entry-point') { 43 | return { path: path.resolve(args.path) }; 44 | } 45 | }); 46 | build.onLoad({ filter: /[\/\\]extensionTests\.ts$/ }, async args => { 47 | const testsRoot = path.join(__dirname, 'src/web/test/suite'); 48 | const files = await glob.glob('*.test.{ts,tsx}', { cwd: testsRoot, posix: true }); 49 | return { 50 | contents: 51 | `export { run } from './mochaTestRunner.ts';` + 52 | files.map(f => `import('./${f}');`).join(''), 53 | watchDirs: files.map(f => path.dirname(path.resolve(testsRoot, f))), 54 | watchFiles: files.map(f => path.resolve(testsRoot, f)) 55 | }; 56 | }); 57 | } 58 | }; 59 | 60 | async function main() { 61 | const ctx = await esbuild.context({ 62 | entryPoints: [ 63 | 'src/web/extension.ts', 64 | 'src/web/test/suite/extensionTests.ts' 65 | ], 66 | bundle: true, 67 | format: 'cjs', 68 | minify: production, 69 | sourcemap: !production, 70 | sourcesContent: false, 71 | platform: 'browser', 72 | outdir: 'dist/web', 73 | external: ['vscode'], 74 | logLevel: 'silent', 75 | // Node.js global to browser globalThis 76 | define: { 77 | global: 'globalThis', 78 | }, 79 | 80 | plugins: [ 81 | polyfill.NodeGlobalsPolyfillPlugin({ 82 | process: true, 83 | buffer: true, 84 | }), 85 | testBundlePlugin, 86 | esbuildProblemMatcherPlugin, /* add to the end of plugins array */ 87 | ], 88 | }); 89 | if (watch) { 90 | await ctx.watch(); 91 | } else { 92 | await ctx.rebuild(); 93 | await ctx.dispose(); 94 | } 95 | } 96 | 97 | main().catch(e => { 98 | console.error(e); 99 | process.exit(1); 100 | }); 101 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-web/eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import typescriptEslint from "@typescript-eslint/eslint-plugin"; 2 | import tsParser from "@typescript-eslint/parser"; 3 | 4 | export default [{ 5 | files: ["**/*.ts"], 6 | }, { 7 | plugins: { 8 | "@typescript-eslint": typescriptEslint, 9 | }, 10 | 11 | languageOptions: { 12 | parser: tsParser, 13 | ecmaVersion: 2022, 14 | sourceType: "module", 15 | }, 16 | 17 | rules: { 18 | "@typescript-eslint/naming-convention": ["warn", { 19 | selector: "import", 20 | format: ["camelCase", "PascalCase"], 21 | }], 22 | 23 | curly: "warn", 24 | eqeqeq: "warn", 25 | "no-throw-literal": "warn", 26 | semi: "warn", 27 | }, 28 | }]; -------------------------------------------------------------------------------- /generators/app/templates/ext-command-web/gitignore: -------------------------------------------------------------------------------- 1 | out 2 | dist 3 | node_modules 4 | .vscode-test-web/ 5 | *.vsix 6 | .env 7 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-web/src/web/extension.ts: -------------------------------------------------------------------------------- 1 | // The module 'vscode' contains the VS Code extensibility API 2 | // Import the module and reference it with the alias vscode in your code below 3 | import * as vscode from 'vscode'; 4 | 5 | // This method is called when your extension is activated 6 | // Your extension is activated the very first time the command is executed 7 | export function activate(context: vscode.ExtensionContext) { 8 | 9 | // Use the console to output diagnostic information (console.log) and errors (console.error) 10 | // This line of code will only be executed once when your extension is activated 11 | console.log('Congratulations, your extension "<%= name %>" is now active in the web extension host!'); 12 | 13 | // The command has been defined in the package.json file 14 | // Now provide the implementation of the command with registerCommand 15 | // The commandId parameter must match the command field in package.json 16 | const disposable = vscode.commands.registerCommand('<%= name %>.helloWorld', () => { 17 | // The code you place here will be executed every time your command is executed 18 | 19 | // Display a message box to the user 20 | vscode.window.showInformationMessage('Hello World from <%= displayName %> in a web extension host!'); 21 | }); 22 | 23 | context.subscriptions.push(disposable); 24 | } 25 | 26 | // This method is called when your extension is deactivated 27 | export function deactivate() {} 28 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-web/src/web/test/suite/esbuild-mochaTestRunner.ts: -------------------------------------------------------------------------------- 1 | // Imports mocha for the browser, defining the `mocha` global. 2 | import 'mocha/mocha'; 3 | 4 | mocha.setup({ 5 | ui: 'tdd', 6 | reporter: undefined 7 | }); 8 | 9 | export function run(): Promise { 10 | 11 | return new Promise((c, e) => { 12 | try { 13 | // Run the mocha test 14 | mocha.run(failures => { 15 | if (failures > 0) { 16 | e(new Error(`${failures} tests failed.`)); 17 | } else { 18 | c(); 19 | } 20 | }); 21 | } catch (err) { 22 | console.error(err); 23 | e(err); 24 | } 25 | }); 26 | } 27 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-web/src/web/test/suite/extension.test.ts: -------------------------------------------------------------------------------- 1 | import * as assert from 'assert'; 2 | 3 | // You can import and use all API from the 'vscode' module 4 | // as well as import your extension to test it 5 | import * as vscode from 'vscode'; 6 | // import * as myExtension from '../../extension'; 7 | 8 | suite('Web Extension Test Suite', () => { 9 | vscode.window.showInformationMessage('Start all tests.'); 10 | 11 | test('Sample test', () => { 12 | assert.strictEqual(-1, [1, 2, 3].indexOf(5)); 13 | assert.strictEqual(-1, [1, 2, 3].indexOf(0)); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-web/src/web/test/suite/webpack-mochaTestRunner.ts: -------------------------------------------------------------------------------- 1 | // Imports mocha for the browser, defining the `mocha` global. 2 | require('mocha/mocha'); 3 | 4 | export function run(): Promise { 5 | 6 | return new Promise((c, e) => { 7 | mocha.setup({ 8 | ui: 'tdd', 9 | reporter: undefined 10 | }); 11 | 12 | // Bundles all files in the current directory matching `*.test` 13 | const importAll = (r: __WebpackModuleApi.RequireContext) => r.keys().forEach(r); 14 | importAll(require.context('.', true, /\.test$/)); 15 | 16 | try { 17 | // Run the mocha test 18 | mocha.run(failures => { 19 | if (failures > 0) { 20 | e(new Error(`${failures} tests failed.`)); 21 | } else { 22 | c(); 23 | } 24 | }); 25 | } catch (err) { 26 | console.error(err); 27 | e(err); 28 | } 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-web/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "Node16", 4 | "target": "ES2020", 5 | "outDir": "dist", 6 | "lib": [ 7 | "ES2020", "WebWorker" 8 | ], 9 | "sourceMap": true, 10 | "rootDir": "src", 11 | "strict": true, /* enable all strict type-checking options */ 12 | /* Additional Checks */ 13 | // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ 14 | // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ 15 | // "noUnusedParameters": true, /* Report errors on unused parameters. */ 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-web/vsc-extension-quickstart.md: -------------------------------------------------------------------------------- 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 web extension. 6 | * `package.json` * this is the manifest file in which you declare your extension and command. 7 | * `src/web/extension.ts` * this is the main file for the browser 8 | * `webpack.config.js` * the webpack config file for the web main 9 | 10 | ## Setup 11 | 12 | * install the recommended extensions (amodio.tsl-problem-matcher, ms-vscode.extension-test-runner, and dbaeumer.vscode-eslint) 13 | 14 | ## Get up and running the Web Extension 15 | 16 | * Run `<%= pkgManager %> install`. 17 | * Place breakpoints in `src/web/extension.ts`. 18 | * Debug via F5 (Run Web Extension). 19 | * Execute extension code via `F1 > Hello world`. 20 | 21 | ## Make changes 22 | 23 | * You can relaunch the extension from the debug toolbar after changing code in `src/web/extension.ts`. 24 | * You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes. 25 | 26 | ## Explore the API 27 | 28 | * You can open the full set of our API when you open the file `node_modules/@types/vscode/index.d.ts`. 29 | 30 | ## Run tests 31 | 32 | * Open the debug viewlet (`Ctrl+Shift+D` or `Cmd+Shift+D` on Mac) and from the launch configuration dropdown pick `Extension Tests`. 33 | * Press `F5` to run the tests in a new window with your extension loaded. 34 | * See the output of the test result in the debug console. 35 | * Make changes to `src/web/test/suite/extension.test.ts` or create new test files inside the `test/suite` folder. 36 | * The provided test runner will only consider files matching the name pattern `**.test.ts`. 37 | * You can create folders inside the `test` folder to structure your tests any way you want. 38 | 39 | ## Go further 40 | 41 | * [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. 42 | * Check out the [Web Extension Guide](https://code.visualstudio.com/api/extension-guides/web-extensions). 43 | * [Publish your extension](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) on the VS Code extension marketplace. 44 | * Automate builds by setting up [Continuous Integration](https://code.visualstudio.com/api/working-with-extensions/continuous-integration). 45 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-web/vscode-esbuild/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "dbaeumer.vscode-eslint", 6 | "connor4312.esbuild-problem-matchers", 7 | "ms-vscode.extension-test-runner" 8 | ] 9 | } -------------------------------------------------------------------------------- /generators/app/templates/ext-command-web/vscode-esbuild/launch.json: -------------------------------------------------------------------------------- 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 Web Extension ", 10 | "type": "extensionHost", 11 | "debugWebWorkerHost": true, 12 | "request": "launch", 13 | "args": [ 14 | "--extensionDevelopmentPath=${workspaceFolder}", 15 | "--extensionDevelopmentKind=web" 16 | ], 17 | "outFiles": [ 18 | "${workspaceFolder}/dist/web/**/*.js" 19 | ], 20 | "preLaunchTask": "${defaultBuildTask}" 21 | }, 22 | { 23 | "name": "Extension Tests", 24 | "type": "extensionHost", 25 | "debugWebWorkerHost": true, 26 | "request": "launch", 27 | "args": [ 28 | "--extensionDevelopmentPath=${workspaceFolder}", 29 | "--extensionDevelopmentKind=web", 30 | "--extensionTestsPath=${workspaceFolder}/dist/web/test/suite/extensionTests" 31 | ], 32 | "outFiles": [ 33 | "${workspaceFolder}/dist/web/**/*.js" 34 | ], 35 | "preLaunchTask": "${defaultBuildTask}" 36 | } 37 | ] 38 | } 39 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-web/vscode-esbuild/settings.json: -------------------------------------------------------------------------------- 1 | // Place your settings in this file to overwrite default and user settings. 2 | { 3 | "files.exclude": { 4 | "dist": false // set this to true to hide the "dist" folder with the compiled JS files 5 | }, 6 | "search.exclude": { 7 | "dist": true // set this to false to include "dist" 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 | } -------------------------------------------------------------------------------- /generators/app/templates/ext-command-web/vscode-esbuild/tasks.json: -------------------------------------------------------------------------------- 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-web", 8 | "dependsOn": [ 9 | "npm: watch-web:tsc", 10 | "npm: watch-web:esbuild" 11 | ], 12 | "presentation": { 13 | "reveal": "never" 14 | }, 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | } 19 | }, 20 | { 21 | "type": "npm", 22 | "script": "watch-web:esbuild", 23 | "group": "build", 24 | "problemMatcher": "$esbuild-watch", 25 | "isBackground": true, 26 | "label": "npm: watch-web:esbuild", 27 | "presentation": { 28 | "group": "watch", 29 | "reveal": "never" 30 | } 31 | }, 32 | { 33 | "type": "npm", 34 | "script": "watch-web:tsc", 35 | "group": "build", 36 | "problemMatcher": "$tsc-watch", 37 | "isBackground": true, 38 | "label": "npm: watch-web:tsc", 39 | "presentation": { 40 | "group": "watch", 41 | "reveal": "never" 42 | } 43 | }, 44 | { 45 | "label": "compile", 46 | "type": "npm", 47 | "script": "compile-web", 48 | "problemMatcher": [ 49 | "$tsc", 50 | "$esbuild" 51 | ] 52 | } 53 | ] 54 | } -------------------------------------------------------------------------------- /generators/app/templates/ext-command-web/vscode-webpack/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "dbaeumer.vscode-eslint", 6 | "amodio.tsl-problem-matcher" 7 | ] 8 | } -------------------------------------------------------------------------------- /generators/app/templates/ext-command-web/vscode-webpack/launch.json: -------------------------------------------------------------------------------- 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 Web Extension ", 10 | "type": "extensionHost", 11 | "debugWebWorkerHost": true, 12 | "request": "launch", 13 | "args": [ 14 | "--extensionDevelopmentPath=${workspaceFolder}", 15 | "--extensionDevelopmentKind=web" 16 | ], 17 | "outFiles": [ 18 | "${workspaceFolder}/dist/web/**/*.js" 19 | ], 20 | "preLaunchTask": "${defaultBuildTask}" 21 | }, 22 | { 23 | "name": "Extension Tests", 24 | "type": "extensionHost", 25 | "debugWebWorkerHost": true, 26 | "request": "launch", 27 | "args": [ 28 | "--extensionDevelopmentPath=${workspaceFolder}", 29 | "--extensionDevelopmentKind=web", 30 | "--extensionTestsPath=${workspaceFolder}/dist/web/test/suite/index" 31 | ], 32 | "outFiles": [ 33 | "${workspaceFolder}/dist/web/**/*.js" 34 | ], 35 | "preLaunchTask": "${defaultBuildTask}" 36 | } 37 | ] 38 | } 39 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-web/vscode-webpack/settings.json: -------------------------------------------------------------------------------- 1 | // Place your settings in this file to overwrite default and user settings. 2 | { 3 | "files.exclude": { 4 | "dist": false // set this to true to hide the "dist" folder with the compiled JS files 5 | }, 6 | "search.exclude": { 7 | "dist": true // set this to false to include "dist" 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 | } -------------------------------------------------------------------------------- /generators/app/templates/ext-command-web/vscode-webpack/tasks.json: -------------------------------------------------------------------------------- 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 | "type": "npm", 8 | "script": "compile-web", 9 | "group": { 10 | "kind": "build", 11 | "isDefault": true 12 | }, 13 | "problemMatcher": [ 14 | "$ts-webpack", 15 | "$tslint-webpack" 16 | ] 17 | }, 18 | { 19 | "type": "npm", 20 | "script": "watch-web", 21 | "group": "build", 22 | "isBackground": true, 23 | "problemMatcher": [ 24 | "$ts-webpack-watch", 25 | "$tslint-webpack-watch" 26 | ] 27 | } 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-web/webpack-package.json: -------------------------------------------------------------------------------- 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 | "browser": "./dist/web/extension.js", 14 | "contributes": { 15 | "commands": [ 16 | { 17 | "command": <%- JSON.stringify(`${name}.helloWorld`) %>, 18 | "title": "Hello World" 19 | } 20 | ] 21 | }, 22 | "scripts": { 23 | "test": "vscode-test-web --browserType=chromium --extensionDevelopmentPath=. --extensionTestsPath=dist/web/test/suite/index.js", 24 | "pretest": "<%= pkgManager %> run compile-web", 25 | "vscode:prepublish": "<%= pkgManager %> run package-web", 26 | "compile-web": "webpack", 27 | "watch-web": "webpack --watch", 28 | "package-web": "webpack --mode production --devtool hidden-source-map", 29 | "lint": "eslint src", 30 | "run-in-browser": "vscode-test-web --browserType=chromium --extensionDevelopmentPath=. ." 31 | }, 32 | "devDependencies": { 33 | <%- dep("@types/vscode") %>, 34 | <%- dep("@types/mocha") %>, 35 | <%- dep("@types/assert") %>, 36 | <%- dep("eslint") %>, 37 | <%- dep("@typescript-eslint/eslint-plugin") %>, 38 | <%- dep("@typescript-eslint/parser") %>, 39 | <%- dep("mocha") %>, 40 | <%- dep("typescript") %>, 41 | <%- dep("@vscode/test-web") %>, 42 | <%- dep("ts-loader") %>, 43 | <%- dep("webpack") %>, 44 | <%- dep("webpack-cli") %>, 45 | <%- dep("@types/webpack-env") %>, 46 | <%- dep("assert") %>, 47 | <%- dep("process") %> 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /generators/app/templates/ext-command-web/webpack.config.js: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | //@ts-check 7 | 'use strict'; 8 | 9 | //@ts-check 10 | /** @typedef {import('webpack').Configuration} WebpackConfig **/ 11 | 12 | const path = require('path'); 13 | const webpack = require('webpack'); 14 | 15 | /** @type WebpackConfig */ 16 | const webExtensionConfig = { 17 | mode: 'none', // this leaves the source code as close as possible to the original (when packaging we set this to 'production') 18 | target: 'webworker', // extensions run in a webworker context 19 | entry: { 20 | 'extension': './src/web/extension.ts', 21 | 'test/suite/index': './src/web/test/suite/index.ts' 22 | }, 23 | output: { 24 | filename: '[name].js', 25 | path: path.join(__dirname, './dist/web'), 26 | libraryTarget: 'commonjs', 27 | devtoolModuleFilenameTemplate: '../../[resource-path]' 28 | }, 29 | resolve: { 30 | mainFields: ['browser', 'module', 'main'], // look for `browser` entry point in imported node modules 31 | extensions: ['.ts', '.js'], // support ts-files and js-files 32 | alias: { 33 | // provides alternate implementation for node module and source files 34 | }, 35 | fallback: { 36 | // Webpack 5 no longer polyfills Node.js core modules automatically. 37 | // see https://webpack.js.org/configuration/resolve/#resolvefallback 38 | // for the list of Node.js core module polyfills. 39 | 'assert': require.resolve('assert') 40 | } 41 | }, 42 | module: { 43 | rules: [{ 44 | test: /\.ts$/, 45 | exclude: /node_modules/, 46 | use: [{ 47 | loader: 'ts-loader' 48 | }] 49 | }] 50 | }, 51 | plugins: [ 52 | new webpack.optimize.LimitChunkCountPlugin({ 53 | maxChunks: 1 // disable chunks by default since web extensions must be a single bundle 54 | }), 55 | new webpack.ProvidePlugin({ 56 | process: 'process/browser', // provide a shim for the global `process` variable 57 | }), 58 | ], 59 | externals: { 60 | 'vscode': 'commonjs vscode', // ignored because it doesn't exist 61 | }, 62 | performance: { 63 | hints: false 64 | }, 65 | devtool: 'nosources-source-map', // create a source map that points to the original source file 66 | infrastructureLogging: { 67 | level: "log", // enables logging required for problem matchers 68 | }, 69 | }; 70 | 71 | module.exports = [ webExtensionConfig ]; -------------------------------------------------------------------------------- /generators/app/templates/ext-extensionpack/.gitattributes: -------------------------------------------------------------------------------- 1 | # Set default behavior to automatically normalize line endings. 2 | * text=auto 3 | -------------------------------------------------------------------------------- /generators/app/templates/ext-extensionpack/.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | .gitignore 4 | vsc-extension-quickstart.md 5 | -------------------------------------------------------------------------------- /generators/app/templates/ext-extensionpack/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to the "<%= name %>" extension pack will be documented in this file. 4 | 5 | Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. 6 | 7 | ## [Unreleased] 8 | 9 | - Initial release 10 | -------------------------------------------------------------------------------- /generators/app/templates/ext-extensionpack/README.md: -------------------------------------------------------------------------------- 1 | # <%- name %> README 2 | 3 | ## Working with Markdown 4 | 5 | You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts: 6 | 7 | * Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux). 8 | * Toggle preview (`Shift+Cmd+V` on macOS or `Shift+Ctrl+V` on Windows and Linux). 9 | * Press `Ctrl+Space` (Windows, Linux, macOS) to see a list of Markdown snippets. 10 | 11 | ## For more information 12 | 13 | * [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown) 14 | * [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/) 15 | 16 | **Enjoy!** 17 | -------------------------------------------------------------------------------- /generators/app/templates/ext-extensionpack/gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.vsix 3 | .env 4 | -------------------------------------------------------------------------------- /generators/app/templates/ext-extensionpack/package.json: -------------------------------------------------------------------------------- 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 | "Extension Packs" 11 | ], 12 | "extensionPack": [ <% for (i=0; i 13 | "<%- extensionList[i] %>", <%}%> 14 | "<%- extensionList[extensionList.length-1]%>" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /generators/app/templates/ext-extensionpack/vsc-extension-quickstart.md: -------------------------------------------------------------------------------- 1 | # Welcome to your VS Code Extension Pack 2 | 3 | ## What's in the folder 4 | 5 | * This folder contains all of the files necessary for your extension pack. 6 | * `package.json` - this is the manifest file that defines the list of extensions of the extension pack. 7 | 8 | ## Get up and running straight away 9 | 10 | * Press `F5` to open a new window with your extension loaded. 11 | * Open `Extensions Viewlet` and check your extensions are installed. 12 | 13 | ## Make changes 14 | 15 | * You can relaunch the extension from the debug toolbar after making changes to the files listed above. 16 | * You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes. 17 | 18 | ## Install your extension 19 | 20 | * To start using your extension with Visual Studio Code copy it into the `/.vscode/extensions` folder and restart Code. 21 | * To share your extension with the world, read on https://code.visualstudio.com/api/working-with-extensions/publishing-extension about publishing an extension. 22 | -------------------------------------------------------------------------------- /generators/app/templates/ext-extensionpack/vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that launches the extension 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": "Extension", 10 | "type": "extensionHost", 11 | "request": "launch", 12 | "args": [ 13 | "--extensionDevelopmentPath=${workspaceFolder}" 14 | ] 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /generators/app/templates/ext-keymap/.gitattributes: -------------------------------------------------------------------------------- 1 | # Set default behavior to automatically normalize line endings. 2 | * text=auto 3 | -------------------------------------------------------------------------------- /generators/app/templates/ext-keymap/.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | .gitignore 4 | vsc-extension-quickstart.md 5 | -------------------------------------------------------------------------------- /generators/app/templates/ext-keymap/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to the "<%= name %>" extension will be documented in this file. 4 | 5 | Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. 6 | 7 | ## [Unreleased] 8 | 9 | - Initial release 10 | -------------------------------------------------------------------------------- /generators/app/templates/ext-keymap/README.md: -------------------------------------------------------------------------------- 1 | # <%- name %> README 2 | 3 | ## Working with Markdown 4 | 5 | You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts: 6 | 7 | * Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux). 8 | * Toggle preview (`Shift+Cmd+V` on macOS or `Shift+Ctrl+V` on Windows and Linux). 9 | * Press `Ctrl+Space` (Windows, Linux, macOS) to see a list of Markdown snippets. 10 | 11 | ## For more information 12 | 13 | * [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown) 14 | * [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/) 15 | 16 | **Enjoy!** 17 | -------------------------------------------------------------------------------- /generators/app/templates/ext-keymap/gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.vsix 3 | .env 4 | -------------------------------------------------------------------------------- /generators/app/templates/ext-keymap/package.json: -------------------------------------------------------------------------------- 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 | "Keymaps" 11 | ], 12 | "contributes": { 13 | "keybindings": [ 14 | { 15 | "key": "ctrl+.", 16 | "command": "workbench.action.showCommands" 17 | } 18 | ] 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /generators/app/templates/ext-keymap/vsc-extension-quickstart.md: -------------------------------------------------------------------------------- 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 pack. 6 | * `package.json` - this is the manifest file that defines the list of keybindings of the extension. 7 | 8 | ## Get up and running straight away 9 | 10 | * Press `F5` to open a new window with your extension loaded. 11 | * Press `Ctrl+.` instead of `Ctrl+Shift+P`. 12 | * Verify that it will launch the Command Palette listing all available commands. The `Ctrl+.` keyboard shortcut was added as an example to you. 13 | 14 | ## Make changes 15 | 16 | * You can relaunch the extension from the debug toolbar after making changes to the files listed above. 17 | * You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes. 18 | 19 | ## Install your extension 20 | 21 | * To start using your extension with Visual Studio Code copy it into the `/.vscode/extensions` folder and restart Code. 22 | * To share your extension with the world, read on https://code.visualstudio.com/api/working-with-extensions/publishing-extension about publishing an extension. 23 | -------------------------------------------------------------------------------- /generators/app/templates/ext-keymap/vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that launches the extension 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": "Extension", 10 | "type": "extensionHost", 11 | "request": "launch", 12 | "args": [ 13 | "--extensionDevelopmentPath=${workspaceFolder}" 14 | ] 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /generators/app/templates/ext-language/.gitattributes: -------------------------------------------------------------------------------- 1 | # Set default behavior to automatically normalize line endings. 2 | * text=auto 3 | -------------------------------------------------------------------------------- /generators/app/templates/ext-language/.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | .gitignore 4 | vsc-extension-quickstart.md 5 | -------------------------------------------------------------------------------- /generators/app/templates/ext-language/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to the "<%= name %>" extension will be documented in this file. 4 | 5 | Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. 6 | 7 | ## [Unreleased] 8 | 9 | - Initial release -------------------------------------------------------------------------------- /generators/app/templates/ext-language/README.md: -------------------------------------------------------------------------------- 1 | # <%= name %> README 2 | 3 | This is the README for your extension "<%= name %>". After writing up a brief description, we recommend including the following sections. 4 | 5 | ## Features 6 | 7 | Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file. 8 | 9 | For example if there is an image subfolder under your extension project workspace: 10 | 11 | \!\[feature X\]\(images/feature-x.png\) 12 | 13 | > Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow. 14 | 15 | ## Requirements 16 | 17 | If you have any requirements or dependencies, add a section describing those and how to install and configure them. 18 | 19 | ## Extension Settings 20 | 21 | Include if your extension adds any VS Code settings through the `contributes.configuration` extension point. 22 | 23 | For example: 24 | 25 | This extension contributes the following settings: 26 | 27 | * `myExtension.enable`: Enable/disable this extension. 28 | * `myExtension.thing`: Set to `blah` to do something. 29 | 30 | ## Known Issues 31 | 32 | Calling out known issues can help limit users opening duplicate issues against your extension. 33 | 34 | ## Release Notes 35 | 36 | Users appreciate release notes as you update your extension. 37 | 38 | ### 1.0.0 39 | 40 | Initial release of ... 41 | 42 | ### 1.0.1 43 | 44 | Fixed issue #. 45 | 46 | ### 1.1.0 47 | 48 | Added features X, Y, and Z. 49 | 50 | --- 51 | 52 | ## Working with Markdown 53 | 54 | You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts: 55 | 56 | * Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux). 57 | * Toggle preview (`Shift+Cmd+V` on macOS or `Shift+Ctrl+V` on Windows and Linux). 58 | * Press `Ctrl+Space` (Windows, Linux, macOS) to see a list of Markdown snippets. 59 | 60 | ## For more information 61 | 62 | * [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown) 63 | * [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/) 64 | 65 | **Enjoy!** 66 | -------------------------------------------------------------------------------- /generators/app/templates/ext-language/gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.vsix 3 | .env 4 | -------------------------------------------------------------------------------- /generators/app/templates/ext-language/language-configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "comments": { 3 | // symbol used for single line comment. Remove this entry if your language does not support line comments 4 | "lineComment": "//", 5 | // symbols used for start and end a block comment. Remove this entry if your language does not support block comments 6 | "blockComment": [ "/*", "*/" ] 7 | }, 8 | // symbols used as brackets 9 | "brackets": [ 10 | ["{", "}"], 11 | ["[", "]"], 12 | ["(", ")"] 13 | ], 14 | // symbols that are auto closed when typing 15 | "autoClosingPairs": [ 16 | ["{", "}"], 17 | ["[", "]"], 18 | ["(", ")"], 19 | ["\"", "\""], 20 | ["'", "'"] 21 | ], 22 | // symbols that can be used to surround a selection 23 | "surroundingPairs": [ 24 | ["{", "}"], 25 | ["[", "]"], 26 | ["(", ")"], 27 | ["\"", "\""], 28 | ["'", "'"] 29 | ] 30 | } -------------------------------------------------------------------------------- /generators/app/templates/ext-language/package.json: -------------------------------------------------------------------------------- 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 | "Programming Languages" 11 | ], 12 | "contributes": { 13 | "languages": [{ 14 | "id": <%- JSON.stringify(languageId) %>, 15 | "aliases": [<%- JSON.stringify(languageName) %>, <%- JSON.stringify(languageId) %>], 16 | "extensions": <%- JSON.stringify(languageExtensions) %>, 17 | "configuration": "./language-configuration.json" 18 | }], 19 | "grammars": [{ 20 | "language": <%- JSON.stringify(languageId) %>, 21 | "scopeName": <%- JSON.stringify(languageScopeName) %>, 22 | "path": <%- JSON.stringify("./syntaxes/" + languageFileName) %> 23 | }] 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /generators/app/templates/ext-language/syntaxes/language.tmLanguage: -------------------------------------------------------------------------------- 1 | <%- languageContent %> -------------------------------------------------------------------------------- /generators/app/templates/ext-language/syntaxes/new.tmLanguage.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", 3 | "name": <%-JSON.stringify(languageName)%>, 4 | "patterns": [ 5 | { 6 | "include": "#keywords" 7 | }, 8 | { 9 | "include": "#strings" 10 | } 11 | ], 12 | "repository": { 13 | "keywords": { 14 | "patterns": [{ 15 | "name": "keyword.control.<%-languageId%>", 16 | "match": "\\b(if|while|for|return)\\b" 17 | }] 18 | }, 19 | "strings": { 20 | "name": "string.quoted.double.<%-languageId%>", 21 | "begin": "\"", 22 | "end": "\"", 23 | "patterns": [ 24 | { 25 | "name": "constant.character.escape.<%-languageId%>", 26 | "match": "\\\\." 27 | } 28 | ] 29 | } 30 | }, 31 | "scopeName": <%-JSON.stringify(languageScopeName)%> 32 | } -------------------------------------------------------------------------------- /generators/app/templates/ext-language/vsc-extension-quickstart.md: -------------------------------------------------------------------------------- 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 language support and define the location of the grammar file that has been copied into your extension. 7 | * `syntaxes/<%= languageFileName %>` - this is the Text mate grammar file that is used for tokenization. 8 | * `language-configuration.json` - this is the language configuration, defining the tokens that are used for comments and brackets. 9 | 10 | ## Get up and running straight away 11 | 12 | * Make sure the language configuration settings in `language-configuration.json` are accurate. 13 | * Press `F5` to open a new window with your extension loaded. 14 | * Create a new file with a file name suffix matching your language. 15 | * Verify that syntax highlighting works and that the language configuration settings are working. 16 | 17 | ## Make changes 18 | 19 | * You can relaunch the extension from the debug toolbar after making changes to the files listed above. 20 | * You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes. 21 | 22 | ## Add more language features 23 | 24 | * To add features such as IntelliSense, hovers and validators check out the VS Code extenders documentation at https://code.visualstudio.com/api/language-extensions/overview 25 | 26 | ## Install your extension 27 | 28 | * To start using your extension with Visual Studio Code copy it into the `/.vscode/extensions` folder and restart Code. 29 | * To share your extension with the world, read on https://code.visualstudio.com/api/working-with-extensions/publishing-extension about publishing an extension. 30 | -------------------------------------------------------------------------------- /generators/app/templates/ext-language/vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that launches the extension 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": "Extension", 10 | "type": "extensionHost", 11 | "request": "launch", 12 | "args": [ 13 | "--extensionDevelopmentPath=${workspaceFolder}" 14 | ] 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /generators/app/templates/ext-localization/.gitattributes: -------------------------------------------------------------------------------- 1 | # Set default behavior to automatically normalize line endings. 2 | * text=auto 3 | -------------------------------------------------------------------------------- /generators/app/templates/ext-localization/.npmrc-pnpm: -------------------------------------------------------------------------------- 1 | enable-pre-post-scripts = true -------------------------------------------------------------------------------- /generators/app/templates/ext-localization/.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | .gitignore 4 | .yarnrc 5 | vsc-extension-quickstart.md 6 | node_modules 7 | -------------------------------------------------------------------------------- /generators/app/templates/ext-localization/.yarnrc: -------------------------------------------------------------------------------- 1 | --ignore-engines true -------------------------------------------------------------------------------- /generators/app/templates/ext-localization/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to the "<%= name %>" language pack will be documented in this file. 4 | 5 | Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. 6 | 7 | ## [Unreleased] 8 | 9 | - Initial release 10 | -------------------------------------------------------------------------------- /generators/app/templates/ext-localization/README.md: -------------------------------------------------------------------------------- 1 | # <%= lpLanguageName %> Language Pack for VS Code 2 | 3 | Adds localization for <%= lpLanguageName %> to VS Code. 4 | 5 | The translated strings are maintained here: 6 | 7 | * [vscode-editor project](https://www.transifex.com/microsoft-oss/vscode-editor/language/<%= lpLanguageId %>/) 8 | * [vscode-workbench project](https://www.transifex.com/microsoft-oss/vscode-workbench/language/<%= lpLanguageId %>/) 9 | * [vscode-extensions project](https://www.transifex.com/microsoft-oss/vscode-extensions/language/<%= lpLanguageId %>/) 10 | 11 | If you'd like to participate in the translation, see https://github.com/Microsoft/Localization/wiki/Visual-Studio-Code-Community-Localization-Project for more information. -------------------------------------------------------------------------------- /generators/app/templates/ext-localization/gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.vsix 3 | .env 4 | -------------------------------------------------------------------------------- /generators/app/templates/ext-localization/package.json: -------------------------------------------------------------------------------- 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 | "Language Packs" 11 | ], 12 | "contributes": { 13 | "localizations": [{ 14 | "languageId": <%- JSON.stringify(lpLanguageId) %>, 15 | "languageName": <%- JSON.stringify(lpLanguageName) %>, 16 | "localizedLanguageName": <%- JSON.stringify(lpLocalizedLanguageName) %> 17 | }] 18 | }, 19 | "scripts": { 20 | "update": "cd ../vscode && <%= pkgManager %> run update-localization-extension <%- lpLanguageId %>" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /generators/app/templates/ext-localization/vsc-extension-quickstart.md: -------------------------------------------------------------------------------- 1 | # Welcome to the <%= lpLanguageName %> language pack 2 | 3 | ## What's in the folder 4 | 5 | * `package.json` - the manifest file, defining the name and description of the localization extension. It also contains the `localizations` contribution point that defines the language id: 6 | 7 | ```json 8 | "contributes": { 9 | "localization": [{ 10 | "languageId": <%- JSON.stringify(lpLanguageId) %>, 11 | "languageName": <%- JSON.stringify(lpLanguageName) %>, 12 | "localizedLanguageName": <%- JSON.stringify(lpLocalizedLanguageName) %> 13 | }] 14 | } 15 | ``` 16 | 17 | * `translations` - the folder containing the translation strings 18 | 19 | To create/update the `translations` folder with the latest strings from transifex, follow these steps: 20 | 21 | * Get an API token from https://www.transifex.com/user/settings/api. The token needs to have access to the `vscode-editor`, `vscode-workbench` and `vscode-extensions` projects. 22 | * Set the API token to the environment variable `TRANSIFEX_API_TOKEN`. 23 | * Check out the `main` branch of the [VS Code repository](https://github.com/Microsoft/vscode). 24 | * Preferably, place the VS Code repo next to the language pack extension (so both have the same parent folder). 25 | * `cd vscode` and run `yarn` to initialize the VS Code repo. More information on how to build VS Code you can find [here](https://github.com/Microsoft/vscode/wiki/How-to-Contribute). 26 | * If the language pack extension is placed next to the VS Code repository: `npm run update-localization-extension <%- lpLanguageId %>` 27 | * Otherwise: `npm run update-localization-extension {path_to_lang_pack_ext}` 28 | * This will download translation files to the folder `translations`. 29 | * `package.json` will be modified and add a `translations` property with paths to each extension's translations will be added. 30 | 31 | ```json 32 | "contributes": { 33 | "localizations": [ 34 | { 35 | "languageId": <%- JSON.stringify(lpLanguageId) %>, 36 | "languageName": <%- JSON.stringify(lpLanguageName) %>, 37 | "localizedLanguageName": <%- JSON.stringify(lpLocalizedLanguageName) %>, 38 | "translations": [ 39 | { 40 | "id": "vscode", 41 | "path": "./translations/main.i18n.json" 42 | }, 43 | { 44 | "id": "vscode.emmet", 45 | "path": "./translations/extensions/emmet.i18n.json" 46 | }, 47 | { 48 | "id": "vscode.css", 49 | "path": "./translations/extensions/css.i18n.json" 50 | }, 51 | { 52 | "id": "vscode.grunt", 53 | "path": "./translations/extensions/grunt.i18n.json" 54 | }, 55 | { 56 | "id": "vscode.git", 57 | "path": "./translations/extensions/git.i18n.json" 58 | }, 59 | { 60 | "id": "vscode.gulp", 61 | "path": "./translations/extensions/gulp.i18n.json" 62 | }, 63 | { 64 | "id": "vscode.jake", 65 | "path": "./translations/extensions/jake.i18n.json" 66 | }, 67 | { 68 | "id": "vscode.html", 69 | "path": "./translations/extensions/html.i18n.json" 70 | }, 71 | { 72 | "id": "vscode.json", 73 | "path": "./translations/extensions/json.i18n.json" 74 | }, 75 | { 76 | "id": "vscode.markdown", 77 | "path": "./translations/extensions/markdown.i18n.json" 78 | }, 79 | { 80 | "id": "vscode.merge-conflict", 81 | "path": "./translations/extensions/merge-conflict.i18n.json" 82 | }, 83 | { 84 | "id": "vscode.npm", 85 | "path": "./translations/extensions/npm.i18n.json" 86 | }, 87 | { 88 | "id": "vscode.php", 89 | "path": "./translations/extensions/php.i18n.json" 90 | }, 91 | { 92 | "id": "vscode.extension-editing", 93 | "path": "./translations/extensions/extension-editing.i18n.json" 94 | }, 95 | { 96 | "id": "vscode.typescript", 97 | "path": "./translations/extensions/typescript.i18n.json" 98 | }, 99 | { 100 | "id": "vscode.configuration-editing", 101 | "path": "./translations/extensions/configuration-editing.i18n.json" 102 | }, 103 | { 104 | "id": "vscode.javascript", 105 | "path": "./translations/extensions/javascript.i18n.json" 106 | }, 107 | { 108 | "id": "ms-vscode.node-debug2", 109 | "path": "./translations/extensions/vscode-node-debug2.i18n.json" 110 | }, 111 | { 112 | "id": "msjsdiag.debugger-for-chrome", 113 | "path": "./translations/extensions/vscode-chrome-debug.i18n.json" 114 | }, 115 | { 116 | "id": "ms-vscode.node-debug", 117 | "path": "./translations/extensions/vscode-node-debug.i18n.json" 118 | } 119 | ] 120 | } 121 | ] 122 | } 123 | ``` 124 | -------------------------------------------------------------------------------- /generators/app/templates/ext-notebook-renderer/.gitattributes: -------------------------------------------------------------------------------- 1 | # Set default behavior to automatically normalize line endings. 2 | * text=auto 3 | -------------------------------------------------------------------------------- /generators/app/templates/ext-notebook-renderer/.npmrc-pnpm: -------------------------------------------------------------------------------- 1 | enable-pre-post-scripts = true -------------------------------------------------------------------------------- /generators/app/templates/ext-notebook-renderer/.vscode-test.mjs: -------------------------------------------------------------------------------- 1 | import { defineConfig } from '@vscode/test-cli'; 2 | 3 | export default defineConfig({ 4 | files: 'out/test/**/*.test.js', 5 | }); 6 | -------------------------------------------------------------------------------- /generators/app/templates/ext-notebook-renderer/.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | out/test/** 4 | src/** 5 | .gitignore 6 | .yarnrc 7 | vsc-extension-quickstart.md 8 | **/tsconfig.json 9 | **/eslint.config.mjs 10 | **/*.map 11 | **/*.ts 12 | **/*.tsbuildinfo 13 | **/.vscode-test.* 14 | -------------------------------------------------------------------------------- /generators/app/templates/ext-notebook-renderer/.yarnrc: -------------------------------------------------------------------------------- 1 | --ignore-engines true -------------------------------------------------------------------------------- /generators/app/templates/ext-notebook-renderer/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to the "<%= name %>" extension will be documented in this file. 4 | 5 | Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. 6 | 7 | ## [Unreleased] 8 | 9 | - Initial release -------------------------------------------------------------------------------- /generators/app/templates/ext-notebook-renderer/README.md: -------------------------------------------------------------------------------- 1 | # <%- name %> README 2 | 3 | ⚠️ Work-in-progress starter code for custom notebook renderers in VS Code. Expect this to change as notebooks matures. ⚠️ 4 | 5 | This starter includes: 6 | 7 | - 🖥️ TypeScript code to create a simple `NotebookOutputRenderer` 8 | - 📦 A Webpack build for renderer client code 9 | - ⚡ Support for hot module reloading and safe boilerplate 10 | - 🎨 CSS modules support 11 | 12 | ## Running this Sample 13 | 14 | 1. `code-insiders <%- name %>`: Open the folder in VS Code Insiders 15 | 1. Hit `F5` to build+debug 16 | 17 | ## Structure 18 | 19 | A Notebook Renderer consists of code that runs in the VS Code Extension Host (Node.js), which registers the renderer and passes data into the UI code running inside a WebView (Browser/DOM). 20 | 21 | This uses TypeScript project references. There are three projects in the `src` directory: 22 | 23 | - `extension` contains the code running in Node.js extension host. It's compiled with `tsc`. 24 | - `client` is the UI code, built by Webpack, with access to the DOM. 25 | - `common` contains code shared between the extension and client. 26 | 27 | When you run `watch`, `compile`, or `dev`, we invoke both `tsc` and `webpack` to compile the extension and the client portion of the code. 28 | -------------------------------------------------------------------------------- /generators/app/templates/ext-notebook-renderer/eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import typescriptEslint from "@typescript-eslint/eslint-plugin"; 2 | import tsParser from "@typescript-eslint/parser"; 3 | 4 | export default [{ 5 | files: ["**/*.ts"], 6 | }, { 7 | plugins: { 8 | "@typescript-eslint": typescriptEslint, 9 | }, 10 | 11 | languageOptions: { 12 | parser: tsParser, 13 | ecmaVersion: 2022, 14 | sourceType: "module", 15 | }, 16 | 17 | rules: { 18 | "@typescript-eslint/naming-convention": ["warn", { 19 | selector: "import", 20 | format: ["camelCase", "PascalCase"], 21 | }], 22 | 23 | curly: "warn", 24 | eqeqeq: "warn", 25 | "no-throw-literal": "warn", 26 | semi: "warn", 27 | }, 28 | }]; -------------------------------------------------------------------------------- /generators/app/templates/ext-notebook-renderer/example/notebook.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "source": [ 6 | "# Your Custom Renderer" 7 | ], 8 | "metadata": {} 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "source": [ 13 | "This is a Jupyter notebook file. Down below, we've created output as if a cell was executed and generated `<%- rendererMimeTypes[0] %>` output. You can use the **View: Reopen Editor With...** command to view the JSON source of this notebook and change the output data. Or, you can installed the Python extension (for example) and replace the code cell below with one that generates the output you expect" 14 | ], 15 | "metadata": {} 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": 1, 20 | "metadata": {}, 21 | "source": [ 22 | "# output>" 23 | ], 24 | "outputs": [ 25 | { 26 | "output_type": "execute_result", 27 | "data": { 28 | "<%- rendererMimeTypes[0] %>": "{\"hello\":\"world!\"}" 29 | }, 30 | "metadata": {}, 31 | "execution_count": 1 32 | } 33 | ] 34 | } 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /generators/app/templates/ext-notebook-renderer/gitignore: -------------------------------------------------------------------------------- 1 | out 2 | node_modules 3 | .vscode-test/ 4 | *.vsix 5 | .env 6 | -------------------------------------------------------------------------------- /generators/app/templates/ext-notebook-renderer/package.json: -------------------------------------------------------------------------------- 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 | "keywords": [ 10 | "notebookRenderer" 11 | ], 12 | "categories": [ 13 | "Other" 14 | ], 15 | "activationEvents": [], 16 | "main": "./out/extension/extension.js", 17 | "browser": "./out/extension/extension.web.js", 18 | "contributes": { 19 | "notebookRenderer": [ 20 | { 21 | "id": <%- JSON.stringify(rendererId) %>, 22 | "entrypoint": "./out/client/index.js", 23 | "displayName": <%- JSON.stringify(rendererDisplayName) %>, 24 | "mimeTypes": <%- JSON.stringify(rendererMimeTypes) %> 25 | } 26 | ] 27 | }, 28 | "scripts": { 29 | "vscode:prepublish": "<%= pkgManager %> run compile", 30 | "compile": "webpack --mode production", 31 | "lint": "eslint src", 32 | "watch": "webpack --mode development --watch", 33 | "pretest": "webpack --mode development && <%= pkgManager %> run lint", 34 | "test": "vscode-test" 35 | }, 36 | "devDependencies": { 37 | <%- dep("@types/mocha") %>, 38 | <%- dep("@types/node") %>, 39 | <%- dep("@types/webpack-env") %>, 40 | <%- dep("@typescript-eslint/eslint-plugin") %>, 41 | <%- dep("@typescript-eslint/parser") %>, 42 | <%- dep("@types/vscode-notebook-renderer") %>, 43 | <%- dep("@types/vscode") %>, 44 | <%- dep("css-loader") %>, 45 | <%- dep("eslint") %>, 46 | <%- dep("fork-ts-checker-webpack-plugin") %>, 47 | <%- dep("glob") %>, 48 | <%- dep("mocha") %>, 49 | <%- dep("style-loader") %>, 50 | <%- dep("ts-loader") %>, 51 | <%- dep("typescript") %>, 52 | <%- dep("vscode-notebook-error-overlay") %>, 53 | <%- dep("@vscode/test-cli") %>, 54 | <%- dep("@vscode/test-electron") %>, 55 | <%- dep("util") %>, 56 | <%- dep("webpack") %>, 57 | <%- dep("webpack-cli") %> 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /generators/app/templates/ext-notebook-renderer/src/client/css.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.css' { 2 | const classes: { [className: string]: string }; 3 | export = classes; 4 | } 5 | -------------------------------------------------------------------------------- /generators/app/templates/ext-notebook-renderer/src/client/index.ts: -------------------------------------------------------------------------------- 1 | import { render } from './render'; 2 | import errorOverlay from 'vscode-notebook-error-overlay'; 3 | import type { ActivationFunction } from 'vscode-notebook-renderer'; 4 | 5 | // Fix the public path so that any async import()'s work as expected. 6 | declare const __webpack_relative_entrypoint_to_root__: string; 7 | declare const scriptUrl: string; 8 | 9 | __webpack_public_path__ = new URL(scriptUrl.replace(/[^/]+$/, '') + __webpack_relative_entrypoint_to_root__).toString(); 10 | 11 | // ---------------------------------------------------------------------------- 12 | // This is the entrypoint to the notebook renderer's webview client-side code. 13 | // This contains some boilerplate that calls the `render()` function when new 14 | // output is available. You probably don't need to change this code; put your 15 | // rendering logic inside of the `render()` function. 16 | // ---------------------------------------------------------------------------- 17 | 18 | export const activate: ActivationFunction = context => { 19 | return { 20 | renderOutputItem(outputItem, element) { 21 | let shadow = element.shadowRoot; 22 | if (!shadow) { 23 | shadow = element.attachShadow({ mode: 'open' }); 24 | const root = document.createElement('div'); 25 | root.id = 'root'; 26 | shadow.append(root); 27 | } 28 | const root = shadow.querySelector('#root')!; 29 | errorOverlay.wrap(root, () => { 30 | root.innerHTML = ''; 31 | const node = document.createElement('div'); 32 | root.appendChild(node); 33 | 34 | render({ container: node, mime: outputItem.mime, value: outputItem.json(), context }); 35 | }); 36 | }, 37 | disposeOutputItem(outputId) { 38 | // Do any teardown here. outputId is the cell output being deleted, or 39 | // undefined if we're clearing all outputs. 40 | } 41 | }; 42 | }; 43 | -------------------------------------------------------------------------------- /generators/app/templates/ext-notebook-renderer/src/client/render.ts: -------------------------------------------------------------------------------- 1 | // We've set up this sample using CSS modules, which lets you import class 2 | // names into JavaScript: https://github.com/css-modules/css-modules 3 | // You can configure or change this in the webpack.config.js file. 4 | import * as style from './style.css'; 5 | import type { RendererContext } from 'vscode-notebook-renderer'; 6 | 7 | interface IRenderInfo { 8 | container: HTMLElement; 9 | mime: string; 10 | value: any; 11 | context: RendererContext; 12 | } 13 | 14 | // This function is called to render your contents. 15 | export function render({ container, mime, value }: IRenderInfo) { 16 | // Format the JSON and insert it as
{ ... }
17 | // Replace this with your custom code! 18 | const pre = document.createElement('pre'); 19 | pre.classList.add(style.json); 20 | const code = document.createElement('code'); 21 | code.textContent = `mime type: ${mime}\n\n${JSON.stringify(value, null, 2)}`; 22 | pre.appendChild(code); 23 | container.appendChild(pre); 24 | } 25 | 26 | if (module.hot) { 27 | module.hot.addDisposeHandler(() => { 28 | // In development, this will be called before the renderer is reloaded. You 29 | // can use this to clean up or stash any state. 30 | }); 31 | } 32 | -------------------------------------------------------------------------------- /generators/app/templates/ext-notebook-renderer/src/client/style.css: -------------------------------------------------------------------------------- 1 | .json code { 2 | font-family: monospace; 3 | font-size: 12px; 4 | color: lightblue; 5 | } 6 | -------------------------------------------------------------------------------- /generators/app/templates/ext-notebook-renderer/src/client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig-base.json", 3 | "compilerOptions": { 4 | // noEmit prevents the default tsc from building this--we use webpack instead 5 | "noEmit": true, 6 | "rootDir": ".", 7 | "module": "esnext", 8 | "moduleResolution": "bundler", 9 | "lib": ["ES2019", "dom"], 10 | "types": ["webpack-env", "vscode-notebook-renderer"], 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /generators/app/templates/ext-notebook-renderer/src/extension/extension.ts: -------------------------------------------------------------------------------- 1 | // The module 'vscode' contains the VS Code extensibility API 2 | // Import the module and reference it with the alias vscode in your code below 3 | import * as vscode from 'vscode'; 4 | 5 | // This method is called when your extension is activated 6 | // Your extension is activated the very first time the command is executed 7 | export function activate(context: vscode.ExtensionContext) { 8 | // Nothing (yet) 9 | } 10 | 11 | // This method is called when your extension is deactivated 12 | export function deactivate() { } 13 | -------------------------------------------------------------------------------- /generators/app/templates/ext-notebook-renderer/src/extension/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig-base.json", 3 | "compilerOptions": { 4 | "rootDir": ".", 5 | "outDir": "../../out/extension", 6 | }, 7 | "references": [] 8 | } 9 | -------------------------------------------------------------------------------- /generators/app/templates/ext-notebook-renderer/src/test/extension.test.ts: -------------------------------------------------------------------------------- 1 | import * as assert from 'assert'; 2 | 3 | // You can import and use all API from the 'vscode' module 4 | // as well as import your extension to test it 5 | import * as vscode from 'vscode'; 6 | // import * as myExtension from '../extension'; 7 | 8 | suite('Extension Test Suite', () => { 9 | vscode.window.showInformationMessage('Start all tests.'); 10 | 11 | test('Sample test', () => { 12 | assert.strictEqual(-1, [1, 2, 3].indexOf(5)); 13 | assert.strictEqual(-1, [1, 2, 3].indexOf(0)); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /generators/app/templates/ext-notebook-renderer/src/test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig-base.json", 3 | "compilerOptions": { 4 | "rootDir": ".", 5 | "outDir": "../../out/test", 6 | }, 7 | "references": [] 8 | } 9 | -------------------------------------------------------------------------------- /generators/app/templates/ext-notebook-renderer/src/tsconfig-base.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "Node16", 4 | "target": "ES2022", 5 | "lib": [ 6 | "ES2022" 7 | ], 8 | "types": ["node"], 9 | "sourceMap": true, 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 | } 17 | -------------------------------------------------------------------------------- /generators/app/templates/ext-notebook-renderer/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": [], 3 | "references": [ 4 | { 5 | "path": "./src/client" 6 | }, 7 | { 8 | "path": "./src/test" 9 | }, 10 | { 11 | "path": "./src/extension" 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /generators/app/templates/ext-notebook-renderer/vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": ["dbaeumer.vscode-eslint", "amodio.tsl-problem-matcher", "ms-vscode.extension-test-runner"] 5 | } 6 | -------------------------------------------------------------------------------- /generators/app/templates/ext-notebook-renderer/vscode/launch.json: -------------------------------------------------------------------------------- 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": "pwa-extensionHost", 11 | "request": "launch", 12 | "args": [ 13 | "--extensionDevelopmentPath=${workspaceFolder}", 14 | "${workspaceFolder}/example" 15 | ], 16 | "outFiles": [ 17 | "${workspaceFolder}/out/**/*.js" 18 | ], 19 | "debugWebviews": true, 20 | "trace": true, 21 | "preLaunchTask": "npm: watch" 22 | }, 23 | { 24 | "name": "Run Extension (no server)", 25 | "type": "extensionHost", 26 | "request": "launch", 27 | "args": [ 28 | "--extensionDevelopmentPath=${workspaceFolder}" 29 | ], 30 | "outFiles": [ 31 | "${workspaceFolder}/out/**/*.js" 32 | ], 33 | "debugWebviews": true, 34 | "preLaunchTask": "npm: watch" 35 | } 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /generators/app/templates/ext-notebook-renderer/vscode/settings.json: -------------------------------------------------------------------------------- 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 | }, 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 | } 12 | -------------------------------------------------------------------------------- /generators/app/templates/ext-notebook-renderer/vscode/tasks.json: -------------------------------------------------------------------------------- 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 | "type": "npm", 8 | "script": "dev", 9 | "problemMatcher": ["$tsc-watch", "$ts-checker-webpack-watch"], 10 | "isBackground": true, 11 | "presentation": { 12 | "reveal": "never" 13 | }, 14 | "group": { 15 | "kind": "build", 16 | "isDefault": true 17 | } 18 | }, 19 | { 20 | "type": "npm", 21 | "script": "watch", 22 | "problemMatcher": ["$tsc-watch", "$ts-checker-webpack-watch"], 23 | "isBackground": true, 24 | "presentation": { 25 | "reveal": "never" 26 | }, 27 | "group": "build" 28 | }, 29 | { 30 | "type": "npm", 31 | "script": "compile", 32 | "problemMatcher": ["$tsc", "$ts-checker-webpack"], 33 | "group": "build" 34 | } 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /generators/app/templates/ext-notebook-renderer/webpack.config.js: -------------------------------------------------------------------------------- 1 | const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); 2 | const { DefinePlugin } = require('webpack'); 3 | const path = require('path'); 4 | 5 | const makeConfig = (argv, { entry, out, target, library = 'commonjs' }) => ({ 6 | mode: argv.mode, 7 | devtool: argv.mode === 'production' ? false : 'inline-source-map', 8 | entry, 9 | target, 10 | output: { 11 | path: path.join(__dirname, path.dirname(out)), 12 | filename: path.basename(out), 13 | publicPath: '', 14 | libraryTarget: library, 15 | chunkFormat: library, 16 | }, 17 | externals: { 18 | vscode: 'commonjs vscode', 19 | }, 20 | resolve: { 21 | extensions: ['.ts', '.tsx', '.js', '.jsx', '.css'], 22 | fallback: { "util": require.resolve("util/") } 23 | }, 24 | experiments: { 25 | outputModule: true, 26 | }, 27 | module: { 28 | rules: [ 29 | // Allow importing ts(x) files: 30 | { 31 | test: /\.tsx?$/, 32 | loader: 'ts-loader', 33 | options: { 34 | configFile: path.join(path.dirname(entry), 'tsconfig.json'), 35 | // transpileOnly enables hot-module-replacement 36 | transpileOnly: true, 37 | compilerOptions: { 38 | // Overwrite the noEmit from the client's tsconfig 39 | noEmit: false, 40 | }, 41 | }, 42 | }, 43 | // Allow importing CSS modules: 44 | { 45 | test: /\.css$/, 46 | use: [ 47 | 'style-loader', 48 | { 49 | loader: 'css-loader', 50 | options: { 51 | importLoaders: 1, 52 | modules: true, 53 | }, 54 | }, 55 | ], 56 | }, 57 | ], 58 | }, 59 | plugins: [ 60 | new ForkTsCheckerWebpackPlugin({ 61 | typescript: { 62 | configFile: path.join(path.dirname(entry), 'tsconfig.json'), 63 | }, 64 | }), 65 | new DefinePlugin({ 66 | // Path from the output filename to the output directory 67 | __webpack_relative_entrypoint_to_root__: JSON.stringify( 68 | path.posix.relative(path.posix.dirname(`/index.js`), '/'), 69 | ), 70 | scriptUrl: 'import.meta.url', 71 | }), 72 | ], 73 | infrastructureLogging: { 74 | level: "log", // enables logging required for problem matchers 75 | }, 76 | }); 77 | 78 | module.exports = (env, argv) => [ 79 | makeConfig(argv, { entry: './src/client/index.ts', out: './out/client/index.js', target: 'web', library: 'module' }), 80 | makeConfig(argv, { entry: './src/extension/extension.ts', out: './out/extension/extension.js', target: 'node' }), 81 | makeConfig(argv, { entry: './src/extension/extension.ts', out: './out/extension/extension.web.js', target: 'webworker' }), 82 | ]; 83 | -------------------------------------------------------------------------------- /generators/app/templates/ext-snippets/.gitattributes: -------------------------------------------------------------------------------- 1 | # Set default behavior to automatically normalize line endings. 2 | * text=auto 3 | -------------------------------------------------------------------------------- /generators/app/templates/ext-snippets/.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | .gitignore 4 | vsc-extension-quickstart.md 5 | -------------------------------------------------------------------------------- /generators/app/templates/ext-snippets/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to the "<%= name %>" extension will be documented in this file. 4 | 5 | Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. 6 | 7 | ## [Unreleased] 8 | 9 | - Initial release -------------------------------------------------------------------------------- /generators/app/templates/ext-snippets/README.md: -------------------------------------------------------------------------------- 1 | # <%= name %> README 2 | 3 | This is the README for your extension "<%= name %>". After writing up a brief description, we recommend including the following sections. 4 | 5 | ## Features 6 | 7 | Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file. 8 | 9 | For example if there is an image subfolder under your extension project workspace: 10 | 11 | \!\[feature X\]\(images/feature-x.png\) 12 | 13 | > Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow. 14 | 15 | ## Requirements 16 | 17 | If you have any requirements or dependencies, add a section describing those and how to install and configure them. 18 | 19 | ## Extension Settings 20 | 21 | Include if your extension adds any VS Code settings through the `contributes.configuration` extension point. 22 | 23 | For example: 24 | 25 | This extension contributes the following settings: 26 | 27 | * `myExtension.enable`: Enable/disable this extension. 28 | * `myExtension.thing`: Set to `blah` to do something. 29 | 30 | ## Known Issues 31 | 32 | Calling out known issues can help limit users opening duplicate issues against your extension. 33 | 34 | ## Release Notes 35 | 36 | Users appreciate release notes as you update your extension. 37 | 38 | ### 1.0.0 39 | 40 | Initial release of ... 41 | 42 | ### 1.0.1 43 | 44 | Fixed issue #. 45 | 46 | ### 1.1.0 47 | 48 | Added features X, Y, and Z. 49 | 50 | --- 51 | 52 | ## Working with Markdown 53 | 54 | You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts: 55 | 56 | * Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux). 57 | * Toggle preview (`Shift+Cmd+V` on macOS or `Shift+Ctrl+V` on Windows and Linux). 58 | * Press `Ctrl+Space` (Windows, Linux, macOS) to see a list of Markdown snippets. 59 | 60 | ## For more information 61 | 62 | * [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown) 63 | * [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/) 64 | 65 | **Enjoy!** 66 | -------------------------------------------------------------------------------- /generators/app/templates/ext-snippets/gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.vsix 3 | .env 4 | -------------------------------------------------------------------------------- /generators/app/templates/ext-snippets/package.json: -------------------------------------------------------------------------------- 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 | "Snippets" 11 | ], 12 | "contributes": { 13 | "snippets": [ 14 | { 15 | "language": <%- JSON.stringify(languageId) %>, 16 | "path": "./snippets/snippets.code-snippets" 17 | } 18 | ] 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /generators/app/templates/ext-snippets/snippets/snippets.code-snippets: -------------------------------------------------------------------------------- 1 | <%- JSON.stringify(snippets, null, '\t') %> -------------------------------------------------------------------------------- /generators/app/templates/ext-snippets/vsc-extension-quickstart.md: -------------------------------------------------------------------------------- 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 that defines the location of the snippet file and specifies the language of the snippets. 7 | * `snippets/snippets.code-snippets` - the file containing all snippets. 8 | 9 | ## Get up and running straight away 10 | 11 | * Press `F5` to open a new window with your extension loaded. 12 | * Create a new file with a file name suffix matching your language. 13 | * Verify that your snippets are proposed on IntelliSense. 14 | 15 | ## Make changes 16 | 17 | * You can relaunch the extension from the debug toolbar after making changes to the files listed above. 18 | * You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes. 19 | 20 | ## Install your extension 21 | 22 | * To start using your extension with Visual Studio Code copy it into the `/.vscode/extensions` folder and restart Code. 23 | * To share your extension with the world, read on https://code.visualstudio.com/api/working-with-extensions/publishing-extension about publishing an extension. 24 | -------------------------------------------------------------------------------- /generators/app/templates/ext-snippets/vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that launches the extension 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": "Extension", 10 | "type": "extensionHost", 11 | "request": "launch", 12 | "args": [ 13 | "--extensionDevelopmentPath=${workspaceFolder}" 14 | ] 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /generators/app/validator.js: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------- 2 | * Copyright (C) Microsoft Corporation. All rights reserved. 3 | *--------------------------------------------------------*/ 4 | var nameRegex = /^[a-z0-9][a-z0-9\-]*$/i; 5 | 6 | /** 7 | * @param {string} publisher 8 | */ 9 | export function validatePublisher(publisher) { 10 | if (!publisher) { 11 | return "Missing publisher name"; 12 | } 13 | 14 | if (!nameRegex.test(publisher)) { 15 | return "Invalid publisher name"; 16 | } 17 | 18 | return true; 19 | } 20 | 21 | /** 22 | * @param {string} id 23 | */ 24 | export function validateExtensionId(id) { 25 | if (!id) { 26 | return "Missing extension identifier"; 27 | } 28 | 29 | if (!nameRegex.test(id)) { 30 | return "Invalid extension identifier"; 31 | } 32 | 33 | return true; 34 | } 35 | 36 | /** 37 | * @param {string | any[]} name 38 | */ 39 | export function validateNonEmpty(name) { 40 | return name && name.length > 0; 41 | } 42 | 43 | const illegalRe = /[\/\?<>\\:\*\|"]/g; 44 | const controlRe = /[\x00-\x1f\x80-\x9f]/g; 45 | const reservedRe = /^\.+$/; 46 | const windowsReservedRe = /^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i; 47 | const windowsTrailingRe = /[\. ]+$/; 48 | 49 | /** 50 | * @param {string} input 51 | */ 52 | export function sanitizeFilename(input) { 53 | return input 54 | .replace(illegalRe, '') 55 | .replace(controlRe, '') 56 | .replace(reservedRe, '') 57 | .replace(windowsReservedRe, '') 58 | .replace(windowsTrailingRe, ''); 59 | }; -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES6", 4 | "module": "node16", 5 | "checkJs": true 6 | }, 7 | "exclude": [ 8 | "node_modules" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "generator-code", 3 | "version": "1.11.9", 4 | "description": "Yeoman generator for Visual Studio Code extensions.", 5 | "keywords": [ 6 | "yeoman-generator", 7 | "vscode", 8 | "visual studio", 9 | "visual studio code", 10 | "vs code", 11 | "extensions" 12 | ], 13 | "type": "module", 14 | "repository": { 15 | "type": "git", 16 | "url": "https://github.com/Microsoft/vscode-generator-code.git" 17 | }, 18 | "bugs": { 19 | "url": "https://github.com/Microsoft/vscode-generator-code/issues" 20 | }, 21 | "main": "./generators/app/index.js", 22 | "homepage": "http://code.visualstudio.com", 23 | "license": "MIT", 24 | "author": { 25 | "name": "VS Code Team", 26 | "url": "https://github.com/Microsoft" 27 | }, 28 | "engines": { 29 | "node": "^18.17.0 || >=20.5.0" 30 | }, 31 | "scripts": { 32 | "test": "mocha", 33 | "prepublishOnly": "npm test", 34 | "preversion": "npm test", 35 | "postversion": "git push && git push --tags" 36 | }, 37 | "dependencies": { 38 | "chalk": "^5.4.1", 39 | "fast-plist": "^0.1.3", 40 | "request-light": "^0.8.0", 41 | "which": "^5.0.0", 42 | "yeoman-generator": "^7.5.1", 43 | "yosay": "^3.0.0" 44 | }, 45 | "devDependencies": { 46 | "@types/mocha": "^10.0.10", 47 | "@types/node": "^18.19.57", 48 | "mocha": "^11.1.0", 49 | "yeoman-environment": "^4.4.3", 50 | "yeoman-test": "^10.1.0", 51 | "jsonc-parser": "^3.3.1" 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /test/fixtures/grammars/foo.tmLanguage.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", 3 | "name": "foo", 4 | "patterns": [ 5 | { 6 | "include": "#keywords" 7 | }, 8 | { 9 | "include": "#strings" 10 | } 11 | ], 12 | "repository": { 13 | "keywords": { 14 | "patterns": [ 15 | { 16 | "name": "keyword.control.foo", 17 | "match": "\\b(if|while|for|return)\\b" 18 | } 19 | ] 20 | }, 21 | "strings": { 22 | "name": "string.quoted.double.foo", 23 | "begin": "\"", 24 | "end": "\"", 25 | "patterns": [ 26 | { 27 | "name": "constant.character.escape.foo", 28 | "match": "\\\\." 29 | } 30 | ] 31 | } 32 | }, 33 | "scopeName": "source.foo" 34 | } -------------------------------------------------------------------------------- /test/fixtures/themes/theme-74.tmTheme: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Issue 74 7 | settings 8 | 9 | 10 | settings 11 | 12 | background 13 | #002B36 14 | caret 15 | #819090 16 | foreground 17 | #839496 18 | invisibles 19 | #073642 20 | lineHighlight 21 | #073642 22 | selection 23 | #073642 24 | 25 | 26 | 27 | name 28 | Classes 29 | scope 30 | 31 | support.class, 32 | entity.name.class, 33 | entity.name.type.class, 34 | meta.class 35 | 36 | settings 37 | 38 | foreground 39 | #C7AF3F 40 | 41 | 42 | 43 | uuid 44 | A4299D9B-1DE5-4BC4-87F6-A757E71B1597 45 | colorSpaceName 46 | sRGB 47 | 48 | 49 | -------------------------------------------------------------------------------- /test/fixtures/tmsnippets/Assert Equal.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | self.assertEqual(${1:expected}, ${2:actual}${3:, '${4:message}'})$0 7 | name 8 | Assert Equal 9 | scope 10 | source.python 11 | tabTrigger 12 | ase 13 | uuid 14 | 190010F6-A759-44C1-A994-479847B23A97 15 | 16 | 17 | -------------------------------------------------------------------------------- /test/fixtures/tmsnippets/Assert Not Equal.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | self.assertNotEqual(${1:expected}, ${2:actual}${3:, '${4:message}'})$0 7 | name 8 | Assert Not Equal 9 | scope 10 | source.python 11 | tabTrigger 12 | asne 13 | uuid 14 | 6A34B01B-9250-43AF-8563-8E47FABA6E77 15 | 16 | 17 | -------------------------------------------------------------------------------- /test/fixtures/tmsnippets/Assert.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | self.assert_(${1:boolean expression}${2:, '${3:message}'})$0 7 | name 8 | Assert 9 | scope 10 | source.python 11 | tabTrigger 12 | as 13 | uuid 14 | AD5B91E1-7DF0-4E4C-B794-591640FAFD08 15 | 16 | 17 | -------------------------------------------------------------------------------- /test/fixtures/tmsnippets/TabInBody.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | tab() 7 | name 8 | Tab In Body 9 | scope 10 | source.python 11 | tabTrigger 12 | tab 13 | uuid 14 | AD5B91E1-7DF0-4E4C-B794-591640FAFD08 15 | 16 | 17 | -------------------------------------------------------------------------------- /test/test-integration.mjs: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------- 2 | * Copyright (C) Microsoft Corporation. All rights reserved. 3 | *--------------------------------------------------------*/ 4 | 5 | import * as path from 'path'; 6 | import { createHelpers } from 'yeoman-test'; 7 | import * as cp from 'child_process'; 8 | 9 | import * as assert from 'assert'; 10 | 11 | import { fileURLToPath } from 'url'; 12 | 13 | describe('integration tests', function () { 14 | this.timeout(7 * 60 * 1000); 15 | 16 | const helpers = createHelpers(); 17 | const appLocation = path.join(fileURLToPath(import.meta.url), '../../generators/app'); 18 | 19 | const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm'; 20 | 21 | it('command-ts integration test (install, compile and run extension tests)', async () => { 22 | 23 | const runResult = await helpers.run(appLocation).withAnswers({ 24 | type: 'ext-command-ts', 25 | name: 'testCom', 26 | displayName: 'Test Com', 27 | description: 'My TestCom', 28 | gitInit: false, 29 | pkgManager: 'npm', 30 | bundler: 'unbundled', 31 | openWith: 'skip' 32 | }); 33 | 34 | //console.log('command-ts with test: Running npm install'); 35 | const res = await doSpawn(npmCommand, ['i'], { cwd: runResult.env.cwd, shell: true }); 36 | if (res.exitCode !== 0) { 37 | assert.fail(`npm installed failed: stdout ${res.stdout} stderr ${res.stderr}`); 38 | } 39 | 40 | const resAudit = await doSpawn(npmCommand, ['audit'], { cwd: runResult.env.cwd, shell: true }); 41 | if (resAudit.exitCode !== 0) { 42 | assert.fail(`npm audit failed: stdout ${resAudit.stdout} stderr ${resAudit.stderr}`); 43 | } 44 | 45 | //console.log('command-ts with test: Running extension compile'); 46 | const res2 = await doSpawn(npmCommand, ['run', 'test'], { cwd: runResult.env.cwd, shell: true }); 47 | if (res2.exitCode !== 0) { 48 | assert.fail(`npm run test failed: stdout ${res2.stdout} stderr ${res2.stderr}`); 49 | } 50 | 51 | runResult.assertFile('testCom/out/extension.js'); 52 | runResult.assertFile('testCom/out/test/extension.test.js'); 53 | }); 54 | 55 | it('command-ts-webpack integration test (install, pack and run extension tests)', async () => { 56 | 57 | const runResult = await helpers.run(appLocation).withAnswers({ 58 | type: 'ext-command-ts', 59 | name: 'testCom', 60 | displayName: 'Test Com', 61 | description: 'My TestCom', 62 | gitInit: false, 63 | pkgManager: 'npm', 64 | bundler: 'webpack', 65 | openWith: 'skip' 66 | }); 67 | 68 | const res = await doSpawn(npmCommand, ['i'], { cwd: runResult.env.cwd, shell: true }); 69 | if (res.exitCode !== 0) { 70 | assert.fail(`npm installed failed: stdout ${res.stdout} stderr ${res.stderr}`); 71 | } 72 | 73 | const resAudit = await doSpawn(npmCommand, ['audit'], { cwd: runResult.env.cwd, shell: true }); 74 | if (resAudit.exitCode !== 0) { 75 | assert.fail(`npm audit failed: stdout ${resAudit.stdout} stderr ${resAudit.stderr}`); 76 | } 77 | 78 | //console.log('command-ts-webpack with test: Running extension compile'); 79 | const res2 = await doSpawn(npmCommand, ['run', 'test'], { cwd: runResult.env.cwd, shell: true }); 80 | if (res2.exitCode !== 0) { 81 | assert.fail(`npm run compile failed: stdout ${res2.stdout} stderr ${res2.stderr}`); 82 | } 83 | 84 | runResult.assertFile('testCom/dist/extension.js'); 85 | runResult.assertFile('testCom/out/test/extension.test.js'); 86 | }); 87 | 88 | it('command-ts-esbuild integration test (install, pack and run extension tests)', async () => { 89 | 90 | const runResult = await helpers.run(appLocation).withAnswers({ 91 | type: 'ext-command-ts', 92 | name: 'testCom', 93 | displayName: 'Test Com', 94 | description: 'My TestCom', 95 | gitInit: false, 96 | pkgManager: 'npm', 97 | bundler: 'esbuild', 98 | openWith: 'skip' 99 | }); 100 | 101 | const res = await doSpawn(npmCommand, ['i'], { cwd: runResult.env.cwd, shell: true }); 102 | if (res.exitCode !== 0) { 103 | assert.fail(`npm installed failed: stdout ${res.stdout} stderr ${res.stderr}`); 104 | } 105 | 106 | const resAudit = await doSpawn(npmCommand, ['audit'], { cwd: runResult.env.cwd, shell: true }); 107 | if (resAudit.exitCode !== 0) { 108 | assert.fail(`npm audit failed: stdout ${resAudit.stdout} stderr ${resAudit.stderr}`); 109 | } 110 | 111 | //console.log('command-ts-esbuild with test: Running extension compile'); 112 | const res2 = await doSpawn(npmCommand, ['run', 'test'], { cwd: runResult.env.cwd, shell: true }); 113 | if (res2.exitCode !== 0) { 114 | assert.fail(`npm run compile failed: stdout ${res2.stdout} stderr ${res2.stderr}`); 115 | } 116 | 117 | runResult.assertFile('testCom/dist/extension.js'); 118 | runResult.assertFile('testCom/out/test/extension.test.js'); 119 | }); 120 | 121 | it('command-ts-web-webpack integration test (install, pack and run extension tests)', async () => { 122 | 123 | const runResult = await helpers.run(appLocation).withAnswers({ 124 | type: 'ext-command-web', 125 | name: 'testCom', 126 | displayName: 'Test Com', 127 | description: 'My TestCom', 128 | gitInit: false, 129 | pkgManager: 'npm', 130 | bundler: 'webpack', 131 | openWith: 'skip' 132 | }); 133 | 134 | const res = await doSpawn(npmCommand, ['i'], { cwd: runResult.env.cwd, shell: true }); 135 | if (res.exitCode !== 0) { 136 | assert.fail(`npm installed failed: stdout ${res.stdout} stderr ${res.stderr}`); 137 | } 138 | 139 | const resAudit = await doSpawn(npmCommand, ['audit'], { cwd: runResult.env.cwd, shell: true }); 140 | if (resAudit.exitCode !== 0) { 141 | assert.fail(`npm audit failed: stdout ${resAudit.stdout} stderr ${resAudit.stderr}`); 142 | } 143 | 144 | //console.log('command-ts-web with test: Running extension compile-web'); 145 | const res2 = await doSpawn(npmCommand, ['run', 'test'], { cwd: runResult.env.cwd, shell: true }); 146 | if (res2.exitCode !== 0) { 147 | assert.fail(`npm run test failed: stdout ${res2.stdout} stderr ${res2.stderr}`); 148 | } 149 | 150 | runResult.assertFile('testCom/dist/web/extension.js'); 151 | runResult.assertFile('testCom/dist/web/test/suite/index.js'); 152 | }); 153 | 154 | it('command-ts-web-esbuild integration test (install, pack and run extension tests)', async () => { 155 | 156 | const runResult = await helpers.run(appLocation).withAnswers({ 157 | type: 'ext-command-web', 158 | name: 'testCom', 159 | displayName: 'Test Com', 160 | description: 'My TestCom', 161 | gitInit: false, 162 | pkgManager: 'npm', 163 | bundler: 'esbuild', 164 | openWith: 'skip' 165 | }); 166 | 167 | const res = await doSpawn(npmCommand, ['i'], { cwd: runResult.env.cwd, shell: true }); 168 | if (res.exitCode !== 0) { 169 | assert.fail(`npm installed failed: stdout ${res.stdout} stderr ${res.stderr}`); 170 | } 171 | 172 | const resAudit = await doSpawn(npmCommand, ['audit'], { cwd: runResult.env.cwd, shell: true }); 173 | if (resAudit.exitCode !== 0) { 174 | assert.fail(`npm audit failed: stdout ${resAudit.stdout} stderr ${resAudit.stderr}`); 175 | } 176 | 177 | //console.log('command-ts-web with test: Running extension compile-web'); 178 | const res2 = await doSpawn(npmCommand, ['run', 'test'], { cwd: runResult.env.cwd, shell: true }); 179 | if (res2.exitCode !== 0) { 180 | assert.fail(`npm run test failed: stdout ${res2.stdout} stderr ${res2.stderr}`); 181 | } 182 | 183 | runResult.assertFile('testCom/dist/web/extension.js'); 184 | runResult.assertFile('testCom/dist/web/test/suite/extensionTests.js'); 185 | }); 186 | }); 187 | 188 | async function doSpawn(execName, allArguments, options) { 189 | return new Promise((resolve, reject) => { 190 | const child = cp.execFile(execName, allArguments, { stdio: 'pipe', ...options }); 191 | let stdout = [], stderr = []; 192 | child.stdout.on('data', (data) => { 193 | stdout.push(data.toString()); 194 | }); 195 | child.stderr.on('data', (data) => { 196 | stderr.push(data.toString()); 197 | }); 198 | child.on('error', (err) => { 199 | reject(err); 200 | }); 201 | child.on('exit', (exitCode) => { 202 | resolve({ exitCode, stdout: stdout.join(''), stderr: stderr.join('') }); 203 | }); 204 | }); 205 | } 206 | 207 | -------------------------------------------------------------------------------- /thirdpartynotices.txt: -------------------------------------------------------------------------------- 1 | THIRD-PARTY SOFTWARE NOTICES AND INFORMATION 2 | For Microsoft vscode-generator-code-extension 3 | 4 | This project incorporates material from the project(s) listed below (collectively, “Third Party Code”). Microsoft is not the original author of the Third Party Code. The original copyright notice and license under which Microsoft received such Third Party Code are set out below. This Third Party Code is licensed to you under their original license terms set forth below. Microsoft reserves all other rights not expressly granted, whether by implication, estoppel or otherwise. 5 | 6 | 1. DefinitelyTyped version 0.0.1 (https://github.com/borisyankov/DefinitelyTyped) 7 | 8 | This project is licensed under the MIT license. 9 | Copyrights are respective of each contributor listed at the beginning of each definition file. 10 | 11 | Permission is hereby granted, free of charge, to any person obtaining a copy 12 | of this software and associated documentation files (the "Software"), to deal 13 | in the Software without restriction, including without limitation the rights 14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | copies of the Software, and to permit persons to whom the Software is 16 | furnished to do so, subject to the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be included in 19 | all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | THE SOFTWARE. -------------------------------------------------------------------------------- /yocode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-generator-code/6e3f05ab46b6186e588094517764fdf42f21d094/yocode.png --------------------------------------------------------------------------------