async function registerAwsExplorerCommands()

in src/awsexplorer/activation.ts [94:211]


async function registerAwsExplorerCommands(
    context: vscode.ExtensionContext,
    awsExplorer: AwsExplorer,
    toolkitOutputChannel: vscode.OutputChannel
): Promise<void> {
    context.subscriptions.push(
        vscode.commands.registerCommand('aws.showRegion', async () => {
            try {
                await globals.awsContextCommands.onCommandShowRegion()
            } finally {
                recordAwsShowRegion()
                recordVscodeActiveRegions({ value: awsExplorer.getRegionNodesSize() })
            }
        })
    )

    context.subscriptions.push(
        vscode.commands.registerCommand('aws.hideRegion', async (node?: RegionNode) => {
            try {
                await globals.awsContextCommands.onCommandHideRegion(safeGet(node, x => x.regionCode))
            } finally {
                recordAwsHideRegion()
                recordVscodeActiveRegions({ value: awsExplorer.getRegionNodesSize() })
            }
        })
    )

    let submitFeedbackPanel: vscode.WebviewPanel | undefined
    context.subscriptions.push(
        vscode.commands.registerCommand('aws.submitFeedback', () => {
            if (submitFeedbackPanel) {
                submitFeedbackPanel.reveal(submitFeedbackPanel.viewColumn || vscode.ViewColumn.One)
            } else {
                submitFeedbackPanel = submitFeedback()

                submitFeedbackPanel.onDidDispose(
                    () => {
                        submitFeedbackPanel = undefined
                    },
                    undefined,
                    context.subscriptions
                )
            }
        })
    )

    context.subscriptions.push(
        vscode.commands.registerCommand('aws.refreshAwsExplorer', async (passive: boolean = false) => {
            awsExplorer.refresh()

            if (!passive) {
                recordAwsRefreshExplorer()
            }
        })
    )

    context.subscriptions.push(
        vscode.commands.registerCommand(
            'aws.deleteCloudFormation',
            async (node: CloudFormationStackNode) =>
                await deleteCloudFormation(() => awsExplorer.refresh(node.parent), node)
        )
    )

    context.subscriptions.push(
        vscode.commands.registerCommand(
            'aws.downloadStateMachineDefinition',
            async (node: StateMachineNode) =>
                await downloadStateMachineDefinition({
                    stateMachineNode: node,
                    outputChannel: toolkitOutputChannel,
                })
        )
    )

    context.subscriptions.push(
        vscode.commands.registerCommand(
            'aws.executeStateMachine',
            async (node: StateMachineNode) =>
                await executeStateMachine({
                    stateMachineNode: node,
                    outputChannel: toolkitOutputChannel,
                })
        )
    )

    context.subscriptions.push(
        vscode.commands.registerCommand(
            'aws.renderStateMachineGraph',
            async (node: StateMachineNode) =>
                await downloadStateMachineDefinition({
                    stateMachineNode: node,
                    outputChannel: toolkitOutputChannel,
                    isPreviewAndRender: true,
                })
        )
    )

    context.subscriptions.push(
        vscode.commands.registerCommand('aws.copyArn', async (node: AWSResourceNode) => await copyArnCommand(node))
    )

    context.subscriptions.push(
        vscode.commands.registerCommand('aws.copyName', async (node: AWSResourceNode) => await copyNameCommand(node))
    )

    context.subscriptions.push(
        vscode.commands.registerCommand('aws.refreshAwsExplorerNode', async (element: AWSTreeNodeBase | undefined) => {
            awsExplorer.refresh(element)
        })
    )

    context.subscriptions.push(
        vscode.commands.registerCommand('aws.loadMoreChildren', async (node: AWSTreeNodeBase & LoadMoreNode) => {
            await loadMoreChildrenCommand(node, awsExplorer)
        })
    )
}