Function types for each command available on the papi. Each extension can extend this interface to add commands that it registers on the papi with papi.commands.registerCommand.

Note: Command names must consist of two strings separated by at least one period. We recommend one period and lower camel case in case we expand the api in the future to allow dot notation.

An extension can extend this interface to add types for the commands it registers by adding the following to its .d.ts file:

declare module 'papi-shared-types' {
export interface CommandHandlers {
'myExtension.myCommand1': (foo: string, bar: number) => string;
'myExtension.myCommand2': (foo: string) => Promise<void>;
}
}
interface CommandHandlers {
    "platform.openDeveloperDocumentationUrl": () => Promise<void>;
    "platform.openProjectSettings": (webViewId: string) => Promise<void>;
    "platform.openSettings": (webViewId?: string) => Promise<void>;
    "platform.openUserSettings": () => Promise<void>;
    "platform.openWindow": (url: string) => Promise<void>;
    "platform.quit": () => Promise<void>;
    "platform.restart": () => Promise<void>;
    "platform.restartExtensionHost": () => Promise<void>;
    "test.addMany": (...nums: number[]) => number;
    "test.echo": (message: string) => string;
    "test.echoExtensionHost": (message: string) => Promise<string>;
    "test.throwError": (message: string) => void;
    "test.throwErrorExtensionHost": (message: string) => void;
}

Properties

"platform.openDeveloperDocumentationUrl": () => Promise<void>

Open a browser to the platform's OpenRPC documentation

"platform.openProjectSettings": (webViewId: string) => Promise<void>

3 December 2024. Renamed to platform.openSettings

"platform.openSettings": (webViewId?: string) => Promise<void>
"platform.openUserSettings": () => Promise<void>

3 December 2024. Renamed to platform.openSettings

"platform.openWindow": (url: string) => Promise<void>

Open a link in a new browser window. Like window.open in the frontend with target='_blank'

"platform.quit": () => Promise<void>

Shut down the application

"platform.restart": () => Promise<void>

Restart the application

"platform.restartExtensionHost": () => Promise<void>
"test.addMany": (...nums: number[]) => number
"test.echo": (message: string) => string
"test.echoExtensionHost": (message: string) => Promise<string>
"test.throwError": (message: string) => void
"test.throwErrorExtensionHost": (message: string) => void