forked from aws/aws-toolkit-vscode
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move some gumby out of CW files (aws#4425)
We are moving gumby commands since this causes CW to import gumby, and gumby code uses fs-extra, and this breaks browser mode Signed-off-by: nkomonen <[email protected]>
- Loading branch information
1 parent
772c53f
commit a8a6d6b
Showing
4 changed files
with
51 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/*! | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import * as vscode from 'vscode' | ||
import { telemetry } from '../shared/telemetry/telemetry' | ||
import { ExtContext } from '../shared/extensions' | ||
import { Commands } from '../shared/vscode/commands2' | ||
import * as CodeWhispererConstants from '../codewhisperer/models/constants' | ||
import { startTransformByQWithProgress, confirmStopTransformByQ } from '../codewhisperer/commands/startTransformByQ' | ||
import { transformByQState } from '../codewhisperer/models/model' | ||
import { AuthUtil } from '../codewhisperer/util/authUtil' | ||
import { CancelActionPositions, logCodeTransformInitiatedMetric } from './telemetry/codeTransformTelemetry' | ||
|
||
export const showTransformByQ = Commands.declare( | ||
{ id: 'aws.awsq.transform', compositeKey: { 0: 'source' } }, | ||
(context: ExtContext) => async (source: string) => { | ||
if (AuthUtil.instance.isConnectionExpired()) { | ||
await AuthUtil.instance.notifyReauthenticate() | ||
} | ||
|
||
if (transformByQState.isNotStarted()) { | ||
logCodeTransformInitiatedMetric(source) | ||
await startTransformByQWithProgress() | ||
} else if (transformByQState.isCancelled()) { | ||
void vscode.window.showInformationMessage(CodeWhispererConstants.cancellationInProgressMessage) | ||
} else if (transformByQState.isRunning()) { | ||
await confirmStopTransformByQ(transformByQState.getJobId(), CancelActionPositions.DevToolsSidePanel) | ||
} | ||
// emit telemetry if clicked from tree node | ||
if (source === CodeWhispererConstants.transformTreeNode) { | ||
telemetry.ui_click.emit({ | ||
elementId: 'amazonq_transform', | ||
passive: false, | ||
}) | ||
} | ||
await Commands.tryExecute('aws.codeWhisperer.refresh') | ||
} | ||
) | ||
|
||
export const showTransformationHub = Commands.declare( | ||
{ id: 'aws.amazonq.showTransformationHub', compositeKey: { 0: 'source' } }, | ||
() => async (source: string) => { | ||
await vscode.commands.executeCommand('workbench.view.extension.aws-codewhisperer-transformation-hub') | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters