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

Migrate functionName to just pipe namedFunction into name #1518

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,12 @@ export * from "./types/command/legacy/CommandV0V1.types";
export * from "./types/command/legacy/CommandV2.types";
export * from "./types/command/legacy/CommandV3.types";
export * from "./types/command/legacy/CommandV4.types";
export * from "./types/command/legacy/CommandV5.types";
export * from "./types/command/legacy/targetDescriptorV2.types";
export * from "./types/command/CommandV5.types";
export * from "./types/command/CommandV6.types";
export * from "./types/command/legacy/PartialTargetDescriptorV3.types";
export * from "./types/command/legacy/PartialTargetDescriptorV4.types";
export * from "./types/command/legacy/PartialTargetDescriptorV5.types";
export * from "./types/CommandServerApi";
export * from "./util/itertools";
export * from "./extensionDependencies";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { PartialTargetDescriptor } from "./PartialTargetDescriptor.types";
import type { ActionCommand } from "./ActionCommand";

export interface CommandV5 {
export interface CommandV6 {
/**
* The version number of the command API
*/
version: 5;
version: 6;

/**
* The spoken form of the command if issued from a voice command system
Expand Down
8 changes: 5 additions & 3 deletions packages/common/src/types/command/command.types.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import type { ActionCommand } from "./ActionCommand";
import type { CommandV5 } from "./CommandV5.types";
import type { CommandV6 } from "./CommandV6.types";
import type { CommandV0, CommandV1 } from "./legacy/CommandV0V1.types";
import type { CommandV2 } from "./legacy/CommandV2.types";
import type { CommandV3 } from "./legacy/CommandV3.types";
import type { CommandV4 } from "./legacy/CommandV4.types";
import { CommandV5 } from "./legacy/CommandV5.types";

export type CommandComplete = Required<Omit<CommandLatest, "spokenForm">> &
Pick<CommandLatest, "spokenForm"> & { action: Required<ActionCommand> };

export const LATEST_VERSION = 5 as const;
export const LATEST_VERSION = 6 as const;

export type CommandLatest = Command & {
version: typeof LATEST_VERSION;
Expand All @@ -20,4 +21,5 @@ export type Command =
| CommandV2
| CommandV3
| CommandV4
| CommandV5;
| CommandV5
| CommandV6;
99 changes: 99 additions & 0 deletions packages/common/src/types/command/legacy/CommandV5.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import { PartialTargetDescriptorV5 } from "./PartialTargetDescriptorV5.types";

const actionNames = [
"callAsFunction",
"clearAndSetSelection",
"copyToClipboard",
"cutToClipboard",
"deselect",
"editNew",
"editNewLineAfter",
"editNewLineBefore",
"executeCommand",
"extractVariable",
"findInWorkspace",
"foldRegion",
"followLink",
"generateSnippet",
"getText",
"highlight",
"indentLine",
"insertCopyAfter",
"insertCopyBefore",
"insertEmptyLineAfter",
"insertEmptyLineBefore",
"insertEmptyLinesAround",
"insertSnippet",
"moveToTarget",
"outdentLine",
"pasteFromClipboard",
"randomizeTargets",
"remove",
"rename",
"replace",
"replaceWithTarget",
"revealDefinition",
"revealTypeDefinition",
"reverseTargets",
"rewrapWithPairedDelimiter",
"experimental.setInstanceReference",
"scrollToBottom",
"scrollToCenter",
"scrollToTop",
"setSelection",
"setSelectionAfter",
"setSelectionBefore",
"showDebugHover",
"showHover",
"showQuickFix",
"showReferences",
"sortTargets",
"swapTargets",
"toggleLineBreakpoint",
"toggleLineComment",
"unfoldRegion",
"wrapWithPairedDelimiter",
"wrapWithSnippet",
] as const;

type ActionType = (typeof actionNames)[number];

interface ActionCommand {
/**
* The action to run
*/
name: ActionType;

/**
* A list of arguments expected by the given action.
*/
args?: unknown[];
}

export interface CommandV5 {
/**
* The version number of the command API
*/
version: 5;

/**
* The spoken form of the command if issued from a voice command system
*/
spokenForm?: string;

/**
* If the command is issued from a voice command system, this boolean indicates
* whether we should use the pre phrase snapshot. Only set this to true if the
* voice command system issues a pre phrase signal at the start of every
* phrase.
*/
usePrePhraseSnapshot: boolean;

action: ActionCommand;

/**
* A list of targets expected by the action. Inference will be run on the
* targets
*/
targets: PartialTargetDescriptorV5[];
}
Loading