Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A comprehensive list of parameters has been drawn up! #65

Open
Yarakashi-Kikohshi opened this issue Jul 12, 2022 · 0 comments
Open

A comprehensive list of parameters has been drawn up! #65

Yarakashi-Kikohshi opened this issue Jul 12, 2022 · 0 comments

Comments

@Yarakashi-Kikohshi
Copy link

Yarakashi-Kikohshi commented Jul 12, 2022

I apologise in advance. This is not a problem with the extension, but I opened it because it is the only way to contact you.

README provides explanations with concrete examples. However, there are cases where a comprehensive explanation would be easier to understand.

I have drawn up the following list.

list

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.

Command ID in 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.

Option parameters

Optional parameters of command sequence.

Parameter type Description
label string Label displayed in command palette when calling manually.
description string Description displayed in command palette when calling manually. (dimmed)
interval number Interval between executions of commands in the sequence. (milliseconds)
languages array The sequence is displayed only when a document of 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 sequence.

list.md
## 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. |

Command ID in `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](#field-keys-in-sequence).

## Option parameters

Optional parameters of command sequence.

|   Parameter   |  type  | Description                                                                                                                    |
| :-----------: | :----: | :----------------------------------------------------------------------------------------------------------------------------- |
|    `label`    | string | Label displayed in command palette when calling manually.                                                                      |
| `description` | string | Description displayed in command palette when calling manually. (dimmed)                                                       |
|  `interval`   | number | Interval between executions of commands in the `sequence`. (milliseconds)                                                      |
|  `languages`  | array  | The sequence is displayed only when a document of 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 `sequence`.

Use it as you wish. If you are willing to do it, add it to the README or create a wiki. This table will help some people.

If errors are found in the list, please correct them appropriately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant