Skip to content

Commit

Permalink
[extensions] release commands to GA (#108)
Browse files Browse the repository at this point in the history
* [extensions] release commands to GA

* fixes
  • Loading branch information
lunaroyster authored Nov 7, 2023
1 parent dd545d5 commit cfb6150
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { extensionPort, proxy } from "../../util/comlink";
import { extensionPort, proxy } from "../util/comlink";
import {
CreateCommand,
CommandProxy,
Expand All @@ -8,7 +8,7 @@ import {
CommandSymbol,
CommandArgs,
isCommandProxy,
} from "../../commands";
} from "../commands";

export interface AddCommandArgs {
/**
Expand Down Expand Up @@ -46,7 +46,7 @@ export function add({ id, contributions, command }: AddCommandArgs) {
return isCommandProxy(cmd) ? cmd : Command(cmd);
});

extensionPort.experimental.commands.registerCreateCommand(
extensionPort.commands.registerCreateCommand(
{ commandId: id, contributions },
createCommand
);
Expand All @@ -55,7 +55,7 @@ export function add({ id, contributions, command }: AddCommandArgs) {
return isCommandProxy(command) ? command : Command(command);
});

extensionPort.experimental.commands.registerCreateCommand(
extensionPort.commands.registerCreateCommand(
{ commandId: id, contributions },
createCommand
);
Expand All @@ -66,7 +66,7 @@ export function add({ id, contributions, command }: AddCommandArgs) {
* @deprecated Use `add` instead
*/
export function register(command: CommandProxy): void {
extensionPort.experimental.commands.registerCommand(command);
extensionPort.commands.registerCommand(command);
}

/**
Expand All @@ -76,7 +76,7 @@ export function registerCreate(
data: { commandId: string; contributions: Array<string> },
createCommand: CreateCommand
): void {
extensionPort.experimental.commands.registerCreateCommand(
extensionPort.commands.registerCreateCommand(
data,
async (args: CommandFnArgs) => {
const cmd = await createCommand(args);
Expand Down
4 changes: 3 additions & 1 deletion modules/extensions/src/api/experimental/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export * as auth from "./auth";
export * as editor from "./editor";
export * as commands from "./commands";

// deprecated from the experimental namespace
export * as commands from "../commands";
2 changes: 2 additions & 0 deletions modules/extensions/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import * as experimental from "./experimental";
import * as internal from "./internal";
import * as exec from "./exec";
import * as debug from "./debug";
import * as commands from "./commands";

export {
fs,
Expand All @@ -22,6 +23,7 @@ export {
internal,
exec,
debug,
commands,
};

// deprecate this after migrating existing extensions
Expand Down
22 changes: 11 additions & 11 deletions modules/extensions/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,17 @@ export type ExtensionPortAPI = {
watchActiveFile: (callback: OnActiveFileChangeListener) => DisposerFunction;
getActiveFile: () => Promise<string | null>;

commands: {
registerCommand: (command: CommandProxy) => void;
registerCreateCommand: (
data: {
commandId: string;
contributions: Array<string>;
},
create: (createArgs: CommandFnArgs) => Promise<CommandProxy | null>
) => void;
};

experimental: ExperimentalAPI;
internal: InternalAPI;
debug: DebugAPI;
Expand Down Expand Up @@ -209,17 +220,6 @@ export type ExperimentalAPI = {
auth: {
getAuthToken: () => Promise<string>;
};

commands: {
registerCommand: (command: CommandProxy) => void;
registerCreateCommand: (
data: {
commandId: string;
contributions: Array<string>;
},
create: (createArgs: CommandFnArgs) => Promise<CommandProxy | null>
) => void;
};
};

export type DebugAPI = {
Expand Down

0 comments on commit cfb6150

Please sign in to comment.