Skip to content

Instantly share code, notes, and snippets.

@yarakos95
Last active July 18, 2022 06:35
Show Gist options
  • Save yarakos95/709ea6eb013f06be4db5155a105a397d to your computer and use it in GitHub Desktop.
Save yarakos95/709ea6eb013f06be4db5155a105a397d to your computer and use it in GitHub Desktop.
List of parameters available in the configuration of multi-command

List of parameters available in the configuration of multi-command in VS Code

Ver.1.6.0

The Japanese version of the list is below.

Main parameters

Parameters required to create command sequence.

Parameter type Description
command string User-defined command name. Available in keybindings.json.
sequence array Include multiple command ID. It will be executed in order from the top.

It is convenient for user-defined command name to start with multiCommand. to avoid conflicts in keybindings.json.

Command ID in the sequence can also be listed in parallel depending on ||. This ensures that if the command on the left side of || is not found, the command on the right side will be executed.

If you want to include arguments etc. in the command, use the field keys. See here.

Optional parameters

Optional parameters of command sequence.

Parameter type Description
label string Label displayed in command palette when calling command sequence manually.
description string Description displayed in command palette when calling command sequence manually. (dimmed)
interval number Interval between executions of commands in the sequence. (milliseconds)
languages array Only visible in the command palette when a document in the specified language is opened. If not specified, it applies to all languages.

If there is no label and description, command (main parameter) is displayed in command palette.

Field keys in sequence

It is used when command ID requires arguments, to specify the number of repetitions, etc. These keys only work in the field.

Key type Description
command string Command ID provided by VS Code or extensions.
args object Arguments of command.
repeat number Number of times command is repeated.
onSuccess array Excuted when the previous command ends with a success.
onFail array Excuted when the previous command ends with an error.
variableSubstitution boolean Set to true if you want to use variable substitution starting with $ in args.

These must be contained within {} in the sequence.

VSCode の multi-command で利用可能なパラメータリスト

Ver.1.6.0

メインパラメータ

コマンドシーケンスを作成に必要なパラメータ。

パラメータ 説明
command 文字列 ユーザー定義されたコマンド名
keybindings.json で利用可能
sequence 配列 複数のコマンド ID を含む
上から順に実行される

ユーザーが定義する commandmultiCommand. から始まるコマンド名にすると、keybindings.json 内での競合を避けられるため便利です。

sequence 内のコマンド ID は || によって複数並記することが可能です。 これは、|| によって分けられた左側のコマンドが見つからなかったとき、右側のコマンドが実行されるようになります。

command に引数等が必要な場合は、フィールドキーを利用します。 ここ を参照してください。

オプションパラメータ

コマンドシーケンスのオプションパラメータ。

パラメータ 説明
label 文字列 手動でコマンドシーケンスを呼び出す際にコマンドパレットに表示されるラベル
description 文字列 手動でコマンドシーケンスを呼び出す際にコマンドパレットに表示される説明
interval 数値 sequence 内のコマンドの実行間隔(ミリ秒)
languages 配列 指定した言語のドキュメントを開いたときにのみコマンドパレットに表示される
指定しない場合は、すべての言語に適用される

labeldescription が構成されていない場合、コマンドパレットには command(メインパラメータ)が表示されます。

sequence 内のフィールドキー

コマンド ID に引数や繰り返す回数等を必要とする場合に利用します。 これらのキーはこのフィールド内でのみ機能します。

キー 説明
command 文字列 VSCode や拡張機能から提供されるコマンド ID
args オブジェクト command の引数
repeat 数値 command を繰り返す回数
onSuccess 配列 一つ前のコマンドが “成功” して終了した際に実行される
onFail 配列 一つ前のコマンドが “失敗” して終了した際に実行される
variableSubstitution 真偽値 args 内で $ から始まる置換変数を利用する際には、true に構成します

これらは sequence 内で {} に含まれている必要があります。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment