Skip to content

Development

Weida Hong edited this page Oct 30, 2022 · 5 revisions

To develop with this VS Code extension, we need VS Code as an IDE.


Debugging Profile

We won't commit the .vscode folder, so by default there is no debugging profile.

Create the debugging file .vscode/launch.json manually before debugging.

Here is a sample debugging file

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "args": [
                "--extensionDevelopmentPath=${workspaceFolder}"
            ],
            "name": "Launch Extension",
            "outFiles": [
                "${workspaceFolder}/out/**/*.js"
            ],
            "request": "launch",
            "runtimeExecutable": "${execPath}",
            "type": "extensionHost"
        }
    ]
}

Usage

Compile the TypeScript into JavaScript.

# Compile the project
npm run compile

# Or we can launch a watching process to do continuous compilation
npm run watch

Press F5 to enter debugging mode. It will open another VS Code instance as extension development host. In that VS Code instance, open a project which already is a Git project with related configurations.

Now we should be able to play around with this extension.


Adding NPM Dependency

We don't use bundle tool to release extension currently. So for each runtime dependency, we need to add a record of node_modules/<package-name> manually.

See Bundling Extensions for more information.

Clone this wiki locally