Skip to content

Development Setup

This page explains how to build and debug the Dline VS Code extension from source. The repository contains three independent npm projects: the root (the extension), webview-ui/ (the React Webview), and docs/ (this documentation site).

ToolRequirement
Git and Git LFSSome media files are stored with Git LFS, so install Git LFS before cloning
Node.jsThe repository .nvmrc is lts/*, and CI uses Node 24. The root package.json does not declare a Node version
VS CodeThe extension declares a minimum of ^1.134.0

The docs/ site separately requires Node.js >=22.12.0.

  1. Clone the repository:

    Terminal window
    git clone https://github.com/TuvokYang/dline.git
  2. Install the extension and Webview dependencies from the repository root:

    Terminal window
    npm run install:all

    This script runs npm install in the root and then in webview-ui/. Running npm install in the root alone does not install the Webview dependencies. CI uses npm ci and npm --prefix webview-ui ci for reproducible installs.

  3. Generate the Protobuf code:

    Terminal window
    npm run protos

    The extension, the Webview, and the host bridge all depend on the generated code, so run it once before the first build. Regenerate whenever you change files under proto/. See Protobuf and ProtoBus.

Installing the root dependencies runs the prepare script, which enables Husky. The pre-commit hook runs lint-staged: it applies Biome check --write to staged files, and when src/shared/storage/state-keys.ts is staged it also regenerates and stages proto/dline/state.proto.

  1. Open the repository root in VS Code and install the recommended extensions when prompted (including esbuild problem matchers and Biome).
  2. In the Run and Debug view, select Run Extension (local).
  3. Press F5. VS Code runs the watch:debug task first, then opens a new window with the development build of Dline loaded.

The watch:debug task generates the Protobuf code and starts the Webview Vite dev server, TypeScript watch, and esbuild watch together. The Run Extension (local) configuration also:

  • sets DLINE_ENVIRONMENT=local, IS_DEV=true, DLINE_LOG_LEVEL=debug, and DLINE_SKIP_MIGRATION=1 (skipping data migration from Cline);
  • reads .env from the repository root through envFile (the file is ignored by .gitignore);
  • disables installed Cline extensions in the debug window to avoid conflicts.

.vscode/launch.json also contains configurations such as Run Extension (production) and Run Extension (staging), which use the default build task watch.

Without F5, run this in a terminal:

Terminal window
npm run dev

It generates the Protobuf code first, then runs esbuild watch and TypeScript type-check watch in parallel. Start the Webview dev server separately:

Terminal window
npm run dev:webview

Run all of these from the repository root.

CommandWhat it does
npm run check-typesGenerates the Protobuf code, then type-checks the extension and the Webview
npm run lintRuns Biome lint, then lint:proto (buf lint plus proto formatting, which rewrites files under proto/ in place)
npm run formatChecks the formatting of changed files with Biome without writing
npm run format:fixFixes formatting and auto-fixable issues in changed files with Biome
npm run test:smokeRuns the smoke test
npm run test:runRuns every Vitest project
npm testGenerates the Protobuf code, then runs every Vitest project
npm run compileType-checks, lints, then builds a development bundle with esbuild
npm run packageType-checks, builds the Webview, lints, then builds a production bundle with esbuild

For test commands, see Testing.

Terminal window
npm run vsix

scripts/package-vsix.mjs picks the package identity from the current branch and the tag pointing at HEAD:

Current HEADExtension nameVersionMarketplace track
main with a vX.Y.Z tagdlineX.Y.Z from the tagRelease
dev with a dev-vX.Y.Z tagdlineX.Y.Z from the tagPre-release
dev without a tagdline-insidersmajor.minor.<Unix seconds>Release

A pre-release is the same tuvokyang.dline extension as the stable release; the VSIX is packaged with the pre-release flag, so users who switch to the pre-release version receive it.

On any other branch, packaging is rejected by default. To build a local test package on a feature branch, name the channel explicitly:

Terminal window
npm run vsix -- --channel ci

The available channels are auto, ci, insiders, pre-release, and production; --out <path> sets the output path.

Packaging is not publishing. Marketplace publication is done by the release workflows in GitHub Actions.