JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 30
  • Score
    100M100P100Q78109F
  • License MIT

Some development tools to simplify the development of vscode extensions

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@tomjs/vscode-dev) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    @tomjs/vscode-dev

    npm node-current (scoped) NPM

    English | 中文

    Some development tools to simplify the development of vscode extensions

    Features

    • Generate package.nls.json based on locales, support i18n Ally
    • Generate vscode.d.ts based on contributes.commands etc. in package.json

    Install

    # pnpm
    pnpm add @tomjs/vscode-dev -D
    
    # yarn
    yarn add @tomjs/vscode-dev -D
    
    # npm
    npm add @tomjs/vscode-dev -D

    Usage

    CLI

    $ vscode-dev --help
    
    vscode-dev/3.0.0
    
    Usage:
      $ vscode-dev [cwd]
    
    Commands:
      [cwd]  Generate package.nls.json and vscode.d.ts for vscode extension development
    
    For more info, run any command with the `--help` flag:
      $ vscode-dev --help
    
    Options:
      --config [config]       The config file path
      --locales [locales]     Specify i18n directory (default: locales)
      --lang [lang]           Specify i18n source language (default: en)
      --dts-dir [dtsDir]      Specify the output directory of d.ts. If not specified, generated in the order "types", "extension", "src", "."
      --dts-name [dtsName]    Specify the output file name of d.ts (default: vscode.d.ts)
      --builtin [...builtin]  Builtin commands
      -w, --watch             Watch mode
      --verbose               Display verbose output
      -h, --help              Display this message
      -v, --version           Display version number

    vscode.d.ts

    // generated by @tomjs/vscode-dev
    import '@tomjs/vscode';
    
    declare module '@tomjs/vscode' {
      type I18nMessageType = 'description' | 'displayName' | 'tomjs.commands.hello';
    
      interface NlsI18n {
        t(message: I18nMessageType, ...args: Array<string | number | boolean>): string;
        t(message: I18nMessageType, args: Record<string, any>): string;
        t(
          ...params:
            | [message: I18nMessageType, ...args: Array<string | number | boolean>]
            | [message: I18nMessageType, args: Record<string, any>]
        ): string;
      }
    }
    
    declare module 'vscode' {
      export type BuiltinCommand = undefined;
      export type UserCommand = 'tomjs.xxx.showHello';
    
      export namespace commands {
        export function registerCommand(
          command: UserCommand,
          callback: (...args: any[]) => any,
          thisArg?: any,
        ): Disposable;
    
        export function registerTextEditorCommand(
          command: UserCommand,
          callback: (textEditor: TextEditor, edit: TextEditorEdit, ...args: any[]) => void,
          thisArg?: any,
        ): Disposable;
    
        export function executeCommand<T = unknown>(
          command: BuiltinCommand | UserCommand,
          ...rest: any[]
        ): Thenable<T>;
      }
    
      export interface Command {
        command?: BuiltinCommand | UserCommand;
      }
    
      export interface StatusBarItem {
        command?: BuiltinCommand | UserCommand;
      }
    }

    config

    • A vscode property in a package.json file.
    • A .vscoderc.js, .vscoderc.ts, .vscoderc.mjs, or .vscoderc.cjs file. (To learn more about how JS files are loaded, see "Loading JS modules".)
    • A vscode.config.js, vscode.config.ts, vscode.config.mjs, or vscode.config.cjs file. (To learn more about how JS files are loaded, see "Loading JS modules".)