From a7f506984f7e19d77be3ae1a48191d1a1683b19c Mon Sep 17 00:00:00 2001 From: Maxim Hayes Date: Wed, 15 Jan 2025 17:47:09 -0500 Subject: [PATCH 1/2] revert: cloud9 related code This code removes nearly all cloud9 codepaths: - Icons, readme generation, scripts - ikp3db lambda/sam debugger support - Cloud9 only codepaths and hacks - Docs and comments mentioning Cloud9 Includes some follow up items as TODOs in code. Some items were left in case they are helpful in the future (e.g. for vscode web or similar). The items should be renamed from Cloud9 if used again in the future. Some examples are Cloud9 runtime environment checks (for lambda/sam), `isCloud9()` and properties/text for Cloud9 IDE, some SAM artifacts, don't start LSP server, etc. Search cloud9 in vscode after merging this change. --- .gitignore | 1 - CONTRIBUTING.md | 2 +- cloud9-toolkit-install.sh | 139 ----------- docs/CODE_GUIDELINES.md | 11 +- docs/arch_runtime.md | 2 - docs/icons.md | 8 +- packages/core/resources/css/base-cloud9.css | 68 ------ .../icons/cloud9/dark/vscode-help.svg | 12 - .../icons/cloud9/light/vscode-help.svg | 12 - packages/core/src/auth/credentials/utils.ts | 5 +- packages/core/src/auth/sso/model.ts | 6 +- packages/core/src/auth/utils.ts | 14 +- .../src/awsService/s3/explorer/s3FileNode.ts | 13 +- packages/core/src/awsexplorer/activation.ts | 26 +-- packages/core/src/awsexplorer/regionNode.ts | 2 - packages/core/src/awsexplorer/toolView.ts | 16 +- packages/core/src/codecatalyst/activation.ts | 37 ++- packages/core/src/codecatalyst/explorer.ts | 13 +- packages/core/src/codecatalyst/model.ts | 54 +---- packages/core/src/codecatalyst/reconnect.ts | 7 +- .../src/codecatalyst/vue/configure/backend.ts | 3 +- .../src/codecatalyst/vue/create/backend.ts | 3 +- .../codecatalyst/wizards/selectResource.ts | 9 +- packages/core/src/codewhisperer/activation.ts | 123 +--------- .../codewhisperer/commands/basicCommands.ts | 5 +- .../commands/invokeRecommendation.ts | 13 +- .../codewhisperer/commands/onAcceptance.ts | 10 +- .../commands/startSecurityScan.ts | 89 +++---- .../src/codewhisperer/models/constants.ts | 5 +- .../core/src/codewhisperer/models/model.ts | 6 - .../service/importAdderProvider.ts | 4 +- .../codewhisperer/service/keyStrokeHandler.ts | 14 +- .../service/recommendationHandler.ts | 9 +- .../service/recommendationService.ts | 68 +----- .../service/referenceLogViewProvider.ts | 14 -- .../core/src/codewhisperer/util/authUtil.ts | 14 +- .../codewhisperer/util/closingBracketUtil.ts | 39 +--- .../core/src/codewhisperer/util/commonUtil.ts | 5 +- .../src/codewhisperer/util/showSsoPrompt.ts | 5 +- .../core/src/codewhisperer/vue/backend.ts | 3 +- packages/core/src/commands.ts | 13 +- packages/core/src/dev/beta.ts | 4 +- .../dynamicResources/awsResourceManager.ts | 3 +- .../explorer/nodes/resourcesNode.ts | 4 +- packages/core/src/extension.ts | 45 +--- packages/core/src/extensionNode.ts | 21 +- packages/core/src/lambda/activation.ts | 4 +- .../src/lambda/commands/createNewSamApp.ts | 11 +- .../core/src/lambda/commands/uploadLambda.ts | 7 +- .../src/lambda/local/debugConfiguration.ts | 14 -- .../core/src/lambda/models/samTemplates.ts | 51 ++-- .../vue/configEditor/samInvokeBackend.ts | 29 +-- .../login/webview/commonAuthViewProvider.ts | 2 +- .../shared/cloudformation/cloudformation.ts | 9 +- packages/core/src/shared/datetime.ts | 6 +- packages/core/src/shared/extensionStartup.ts | 81 +------ .../core/src/shared/extensionUtilities.ts | 8 +- .../core/src/shared/filesystemUtilities.ts | 1 - packages/core/src/shared/fs/fs.ts | 65 +----- packages/core/src/shared/icons.ts | 21 +- .../core/src/shared/regions/regionProvider.ts | 17 +- packages/core/src/shared/sam/activation.ts | 15 +- .../src/shared/sam/cli/samCliLocalInvoke.ts | 1 - .../sam/debugger/awsSamDebugConfiguration.ts | 7 +- .../src/shared/sam/debugger/awsSamDebugger.ts | 29 +-- .../src/shared/sam/debugger/pythonSamDebug.ts | 123 ++-------- .../core/src/shared/sam/processTerminal.ts | 16 -- packages/core/src/shared/settings.ts | 1 - .../core/src/shared/telemetry/activation.ts | 4 +- packages/core/src/shared/telemetry/util.ts | 5 +- .../shared/treeview/nodes/awsTreeNodeBase.ts | 7 +- packages/core/src/shared/ui/inputPrompter.ts | 2 - .../core/src/shared/utilities/messages.ts | 7 +- .../src/shared/utilities/textUtilities.ts | 5 +- packages/core/src/stepFunctions/utils.ts | 4 +- .../test/lambda/commands/uploadLambda.test.ts | 9 - .../test/lambda/models/samTemplates.test.ts | 3 - .../test/lambda/vue/samInvokeBackend.test.ts | 35 +-- .../core/src/test/shared/datetime.test.ts | 3 +- packages/core/src/test/shared/fs/fs.test.ts | 54 ----- packages/core/src/test/shared/icons.test.ts | 45 +--- .../test/shared/sam/cli/samCliInit.test.ts | 5 - .../debugger/samDebugConfigProvider.test.ts | 219 ------------------ .../core/src/test/shared/settings.test.ts | 2 +- packages/core/src/webviews/main.ts | 23 +- ...-3ef48be0-d3f3-4252-be69-9a0684406944.json | 4 + packages/toolkit/README.quickstart.cloud9.md | 146 ------------ scripts/generateIcons.ts | 26 +-- scripts/generateNonCodeFiles.ts | 2 - 89 files changed, 264 insertions(+), 1843 deletions(-) delete mode 100644 cloud9-toolkit-install.sh delete mode 100644 packages/core/resources/css/base-cloud9.css delete mode 100644 packages/core/resources/icons/cloud9/dark/vscode-help.svg delete mode 100644 packages/core/resources/icons/cloud9/light/vscode-help.svg create mode 100644 packages/toolkit/.changes/next-release/Removal-3ef48be0-d3f3-4252-be69-9a0684406944.json delete mode 100644 packages/toolkit/README.quickstart.cloud9.md diff --git a/.gitignore b/.gitignore index eeb136eea4a..596af538b2e 100644 --- a/.gitignore +++ b/.gitignore @@ -47,7 +47,6 @@ packages/amazonq/package.nls.json packages/amazonq/resources # Icons -packages/*/resources/icons/cloud9/generated/** packages/*/resources/fonts/aws-toolkit-icons.woff packages/*/resources/css/icons.css diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c4dba3042e2..087d6e838ab 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -633,7 +633,7 @@ If you are contribuing visual assets from other open source repos, the source re ## Using new vscode APIs The minimum required vscode version specified in [package.json](https://github.com/aws/aws-toolkit-vscode/blob/07119655109bb06105a3f53bbcd86b812b32cdbe/package.json#L16) -is decided by the version of vscode running in Cloud9 and other vscode-compatible targets. +is decided by the version of vscode running in other supported vscode-compatible targets (e.g. web). But you can still use the latest vscode APIs, by checking the current running vscode version. For example, to use a vscode 1.64 API: diff --git a/cloud9-toolkit-install.sh b/cloud9-toolkit-install.sh deleted file mode 100644 index 8b85a56a63a..00000000000 --- a/cloud9-toolkit-install.sh +++ /dev/null @@ -1,139 +0,0 @@ -#!/bin/env bash - -# By default, this script gets the latest VSIX from: -# https://github.com/aws/aws-toolkit-vscode/releases/ -# else the first argument must be a URL or file pointing to a toolkit VSIX or -# ZIP (containing a VSIX). -# -# USAGE: -# cloud9-toolkit-install.sh [URL|FILE] -# curl -LO https://raw.githubusercontent.com/aws/aws-toolkit-vscode/master/cloud9-toolkit-install.sh && bash cloud9-toolkit-install.sh -# EXAMPLES: -# cloud9-toolkit-install.sh https://github.com/aws/aws-toolkit-vscode/releases/download/v1.24.0/aws-toolkit-vscode-1.24.0.vsix -# cloud9-toolkit-install.sh toolkit.zip - -set -eu - -# Script currently depends on $HOME so running as root is not supported. -if [ "$(whoami)" = root ]; then - echo "cannot run as root" - exit 1 -fi - -_log() { - echo >&2 "$@" -} - -# Runs whatever is passed. -# -# On failure: -# - prints the command output -# - exits the script -_run() { - local out - if ! out="$("$@" 2>&1)"; then - _log "Command failed (output below): '${*}'" - echo "$out" | sed 's/^/ /' - _log "Command failed (output above): '${*}'" - exit 1 - fi -} - -# Gets the first existing directory, or exits if none are found. -_any_dir() { - for d in "$@"; do - if test -d "$d"; then - echo "$d" - return - fi - done - - _log "error: None of the expected dirs exist:" - for d in "$@"; do - _log " $d" - done - exit 1 -} - -_setglobals() { - # Example: - # https://github.com/aws/aws-toolkit-vscode/releases/tag/v1.24.0 - TOOLKIT_LATEST_RELEASE_URL="$(curl -Ls -o /dev/null -w '%{url_effective}' 'https://github.com/aws/aws-toolkit-vscode/releases/latest')" - # Example: - # 1.24.0 - TOOLKIT_LATEST_VERSION="$(echo "$TOOLKIT_LATEST_RELEASE_URL" | grep -oh '[0-9]\+\.[0-9]\+\.[0-9]\+$')" - # Example: - # https://github.com/aws/aws-toolkit-vscode/releases/download/v1.24.0/aws-toolkit-vscode-1.24.0.vsix - TOOLKIT_LATEST_ARTIFACT_URL="https://github.com/aws/aws-toolkit-vscode/releases/download/v${TOOLKIT_LATEST_VERSION}/aws-toolkit-vscode-${TOOLKIT_LATEST_VERSION}.vsix" - # URL or local filepath pointing to toolkit VSIX or ZIP (containing a VSIX). - TOOLKIT_FILE=${1:-} - TOOLKIT_INSTALL_PARENT="$(_any_dir "/projects/.c9/aws-toolkit-vscode" "$HOME/.c9/dependencies/aws-toolkit-vscode" "$HOME/environment/.c9/extensions" "$HOME/.c9/aws-toolkit-vscode")" - # Hash name is 128 chars long. - TOOLKIT_INSTALL_DIR="$(_any_dir "$(realpath ${TOOLKIT_INSTALL_PARENT}/????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????)" "$(realpath ${TOOLKIT_INSTALL_PARENT}/extension)")" - SCRIPT_WORKDIR="$HOME/toolkit" -} - -_main() { - ( - if test -f "$TOOLKIT_FILE"; then - # Ensure full path (before `cd` below). - TOOLKIT_FILE="$(readlink -f "$TOOLKIT_FILE")" - fi - - echo "Script will DELETE these directories:" - echo " ${TOOLKIT_INSTALL_DIR}" - echo " ${SCRIPT_WORKDIR}" - read -n1 -r -p "ENTER to continue, CTRL-c to cancel" - rm -rf "${TOOLKIT_INSTALL_DIR}.old" - mv "$TOOLKIT_INSTALL_DIR" "${TOOLKIT_INSTALL_DIR}.old" - rm -rf "$SCRIPT_WORKDIR" - - cd "$HOME/" - mkdir -p "$SCRIPT_WORKDIR" - mkdir -p "$TOOLKIT_INSTALL_PARENT" - cd "${SCRIPT_WORKDIR}" - - # Set default URL if no argument was provided. - if test -z "$TOOLKIT_FILE"; then - _log "Latest release:" - _log " URL : $TOOLKIT_LATEST_RELEASE_URL" - _log " version: $TOOLKIT_LATEST_VERSION" - _log " VSIX : $TOOLKIT_LATEST_ARTIFACT_URL" - TOOLKIT_FILE="$TOOLKIT_LATEST_ARTIFACT_URL" - fi - - TOOLKIT_FILE_EXTENSION="${TOOLKIT_FILE: -4}" - if test -f "$TOOLKIT_FILE"; then - _log "Local file (not URL): ${TOOLKIT_FILE}" - if [ "$TOOLKIT_FILE_EXTENSION" = ".zip" ] || [ "$TOOLKIT_FILE_EXTENSION" = ".ZIP" ]; then - _log 'File is a .zip file' - _run unzip -- "$TOOLKIT_FILE" - _run unzip -- *.vsix - else - _log 'File is not .zip file, assuming .vsix' - _run unzip -- "$TOOLKIT_FILE" - fi - else - _log "URL: ${TOOLKIT_FILE}" - _log 'Deleting toolkit.zip' - rm -rf toolkit.zip - _log 'Downloading...' - curl -o toolkit.zip -L "$TOOLKIT_FILE" - if [ "$TOOLKIT_FILE_EXTENSION" = ".zip" ] || [ "$TOOLKIT_FILE_EXTENSION" = ".ZIP" ]; then - _log 'File is a .zip file' - _run unzip -- toolkit.zip - _run unzip -- *.vsix - else - _log 'File is not .zip file, assuming .vsix' - _run unzip -- toolkit.zip - fi - fi - - mv extension "$TOOLKIT_INSTALL_DIR" - _log "Toolkit installed to: $TOOLKIT_INSTALL_DIR" - _log "Refresh Cloud9 to load it" - ) -} - -_setglobals "$@" -_main diff --git a/docs/CODE_GUIDELINES.md b/docs/CODE_GUIDELINES.md index 50471b3d286..90153905b12 100644 --- a/docs/CODE_GUIDELINES.md +++ b/docs/CODE_GUIDELINES.md @@ -81,13 +81,10 @@ that is a net cost. - Telemetry: "active" vs "passive" - Active (`passive:false`) metrics are those intended to appear in DAU count. - Icons: - - Where possible, use IDE-specific standard icons (e.g. standard VSCode - standard icons in VSCode, and Cloud9 standard icons in Cloud9). The typical - (maintainable) way to do this is to use _named_ icons (what VSCode calls + - Where possible, use standard VSCode icons. The typical (maintainable) + way to do this is to use _named_ icons (what VSCode calls [codicons](https://microsoft.github.io/vscode-codicons/)) as opposed to icons shipped with the Toolkit build and referenced by _path_. - - For cases where icons must be statically defined (package.json), if Cloud9 - does not support the VSCode standard icon, use the Cloud9 icon. - Changelog guidelines - Prefer active voice: "You can do X" instead of "X can be done" - Avoid unnecessary use of `lodash` (which we may remove in the future). @@ -240,11 +237,11 @@ _See also [arch_develop.md](./arch_develop.md#exceptions)._ - PREFER: ```ts - things.filter(o => o.isFoo) + things.filter((o) => o.isFoo) ``` - INSTEAD OF: ```ts - things.filter(thing => thing.isFoo) + things.filter((thing) => thing.isFoo) ``` ## User settings diff --git a/docs/arch_runtime.md b/docs/arch_runtime.md index d2c5902c333..e1cbfd01661 100644 --- a/docs/arch_runtime.md +++ b/docs/arch_runtime.md @@ -31,8 +31,6 @@ If you must define a new key (is it _really_ necessary?), follow these guideline These keys are currently set by the core/ package, but many of them may eventually be migrated to toolkit/ or amazonq/ if appropriate. -- `isCloud9`: This is hardcoded by Cloud9 itself, not the Toolkit. - - Cloud9 _does not support setContext_. So this is the only usable key there. - `aws.codecatalyst.connected`: CodeCatalyst connection is active. - `aws.codewhisperer.connected`: CodeWhisperer connection is active. - `aws.codewhisperer.connectionExpired`: CodeWhisperer connection is active, but the connection is expired. diff --git a/docs/icons.md b/docs/icons.md index d5a2144085f..46e252d5dac 100644 --- a/docs/icons.md +++ b/docs/icons.md @@ -4,7 +4,6 @@ All icons that are used in the extensions can be found in `resources/icons`. A [build script](../scripts/generateIcons.ts) generates extension artifacts in [core/](../packages/core/): -- `resources/icons/cloud9/generated` - `resources/fonts/aws-toolkit-icons.woff` - `resources/css/icons.css` - `contributes.icons` in [amazonq package.json](../packages/amazonq/package.json) and [toolkit package.json](../packages/toolkit/package.json) @@ -31,7 +30,7 @@ If your desired icon does not work well as a font, see [Theme Overrides](#theme- ## Identifiers -Icons (except those in `cloud9`) can be referenced within the Toolkit by concatenating the icon path with hyphens, omitting the 'theme' if applicable. +Icons can be referenced within the Toolkit by concatenating the icon path with hyphens, omitting the 'theme' if applicable. Examples: @@ -50,11 +49,6 @@ For example, if I wanted to use a special App Runner service icon, then I need t - `resources/icons/aws/dark/apprunner-service.svg` - `resources/icons/aws/light/apprunner-service.svg` -A similar format is used for overriding icons only on Cloud9: - -- `resources/icons/cloud9/dark/aws-apprunner-service.svg` -- `resources/icons/cloud9/light/aws-apprunner-service.svg` - These icons will **not** be usuable as Codicons or as font icons. ## Third Party diff --git a/packages/core/resources/css/base-cloud9.css b/packages/core/resources/css/base-cloud9.css deleted file mode 100644 index ec1e30468c6..00000000000 --- a/packages/core/resources/css/base-cloud9.css +++ /dev/null @@ -1,68 +0,0 @@ -/* TODO: remove this when Cloud9 injects the correct styling information into webviews */ -@import url('./base.css'); - -body { - /* Temporary variables for C9 to shade/tint elements. Best-effort styling based off current theme. */ - /* Since these are applied as rgba, it's very easy to make things look 'washed-out' or too dark */ - --tint: 255, 255, 255; - --shade: 0, 0, 0; -} - -input[type='text'][data-invalid='true'], -input[type='number'][data-invalid='true'] { - border: 1px solid var(--vscode-inputValidation-errorBorder); - border-bottom: 0; - background: none; -} - -/* "Cloud9 gray" in input boxes (not buttons/radios). */ -body.vscode-dark input:not([type='submit']):not([type='radio']) { - background-color: rgba(var(--shade), 0.1); -} - -input:disabled { - filter: none; -} - -body.vscode-dark select { - background: rgba(var(--shade), 0.1); -} - -body.vscode-dark .header { - background-color: rgba(var(--tint), 0.02); -} -body.vscode-light .header { - background-color: rgba(var(--shade), 0.02); -} - -body.vscode-dark .notification { - background-color: #2a2a2a; -} -body.vscode-light .notification { - background-color: #f7f7f7; - box-shadow: 2px 2px 8px #aaa; -} - -button:disabled { - filter: none; -} - -/* Text area */ -textarea { - background: none; -} -body.vscode-dark textarea { - background: rgba(var(--shade), 0.1); -} - -/* Overrides */ -body.vscode-dark .settings-panel { - background: rgba(var(--tint), 0.02) !important; -} -body.vscode-light .settings-panel { - background: rgba(var(--shade), 0.02) !important; -} - -.button-container h1 { - margin: 0px; -} diff --git a/packages/core/resources/icons/cloud9/dark/vscode-help.svg b/packages/core/resources/icons/cloud9/dark/vscode-help.svg deleted file mode 100644 index 94b17dfd8b4..00000000000 --- a/packages/core/resources/icons/cloud9/dark/vscode-help.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/packages/core/resources/icons/cloud9/light/vscode-help.svg b/packages/core/resources/icons/cloud9/light/vscode-help.svg deleted file mode 100644 index 81c89a3b963..00000000000 --- a/packages/core/resources/icons/cloud9/light/vscode-help.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/packages/core/src/auth/credentials/utils.ts b/packages/core/src/auth/credentials/utils.ts index 891e17a6486..28fa5df1c4c 100644 --- a/packages/core/src/auth/credentials/utils.ts +++ b/packages/core/src/auth/credentials/utils.ts @@ -10,7 +10,6 @@ import * as vscode from 'vscode' import { Credentials } from '@aws-sdk/types' import { authHelpUrl } from '../../shared/constants' import globals from '../../shared/extensionGlobals' -import { isCloud9 } from '../../shared/extensionUtilities' import { messages, showMessageWithCancel, showViewLogsMessage } from '../../shared/utilities/messages' import { Timeout, waitTimeout } from '../../shared/utilities/timeoutUtils' import { fromExtensionManifest } from '../../shared/settings' @@ -37,8 +36,8 @@ export function asEnvironmentVariables(credentials: Credentials): NodeJS.Process export function showLoginFailedMessage(credentialsId: string, errMsg: string): void { const getHelp = localize('AWS.generic.message.getHelp', 'Get Help...') const editCreds = messages.editCredentials(false) - // TODO: getHelp page for Cloud9. - const buttons = isCloud9() ? [editCreds] : [editCreds, getHelp] + // TODO: Any work towards web/another cloud9 -esqe IDE may need different getHelp docs: + const buttons = [editCreds, getHelp] void showViewLogsMessage( localize('AWS.message.credentials.invalid', 'Credentials "{0}" failed to connect: {1}', credentialsId, errMsg), diff --git a/packages/core/src/auth/sso/model.ts b/packages/core/src/auth/sso/model.ts index 2a05692148e..6cc462d8a57 100644 --- a/packages/core/src/auth/sso/model.ts +++ b/packages/core/src/auth/sso/model.ts @@ -15,7 +15,6 @@ import { CancellationError } from '../../shared/utilities/timeoutUtils' import { ssoAuthHelpUrl } from '../../shared/constants' import { openUrl } from '../../shared/utilities/vsCodeUtils' import { ToolkitError } from '../../shared/errors' -import { isCloud9 } from '../../shared/extensionUtilities' import { builderIdStartUrl } from './constants' export interface SsoToken { @@ -116,10 +115,7 @@ export async function openSsoPortalLink(startUrl: string, authorization: Authori async function showLoginNotification() { const name = startUrl === builderIdStartUrl ? localizedText.builderId() : localizedText.iamIdentityCenterFull() - // C9 doesn't support `detail` field with modals so we need to put it all in the `title` - const title = isCloud9() - ? `Confirm Code "${authorization.userCode}" for ${name} in the browser.` - : localize('AWS.auth.loginWithBrowser.messageTitle', 'Confirm Code for {0}', name) + const title = localize('AWS.auth.loginWithBrowser.messageTitle', 'Confirm Code for {0}', name) const detail = localize( 'AWS.auth.loginWithBrowser.messageDetail', 'Confirm this code in the browser: {0}', diff --git a/packages/core/src/auth/utils.ts b/packages/core/src/auth/utils.ts index d160ce4b490..dd008a55fb4 100644 --- a/packages/core/src/auth/utils.ts +++ b/packages/core/src/auth/utils.ts @@ -20,7 +20,7 @@ import { TreeNode } from '../shared/treeview/resourceTreeDataProvider' import { createInputBox } from '../shared/ui/inputPrompter' import { CredentialSourceId, telemetry } from '../shared/telemetry/telemetry' import { createCommonButtons, createExitButton, createHelpButton, createRefreshButton } from '../shared/ui/buttons' -import { getIdeProperties, isAmazonQ, isCloud9 } from '../shared/extensionUtilities' +import { getIdeProperties, isAmazonQ } from '../shared/extensionUtilities' import { addScopes, getDependentAuths } from './secondaryAuth' import { DevSettings } from '../shared/settings' import { createRegionPrompter } from '../shared/ui/common/region' @@ -562,9 +562,9 @@ export class AuthNode implements TreeNode { if (conn !== undefined && conn.state !== 'valid') { item.iconPath = getIcon('vscode-error') if (conn.state === 'authenticating') { - this.setDescription(item, 'authenticating...') + item.description = 'authenticating...' } else { - this.setDescription(item, 'expired or invalid, click to authenticate') + item.description = 'expired or invalid, click to authenticate' item.command = { title: 'Reauthenticate', command: '_aws.toolkit.auth.reauthenticate', @@ -578,14 +578,6 @@ export class AuthNode implements TreeNode { return item } - - private setDescription(item: vscode.TreeItem, text: string) { - if (isCloud9()) { - item.tooltip = item.tooltip ?? text - } else { - item.description = text - } - } } export async function hasIamCredentials( diff --git a/packages/core/src/awsService/s3/explorer/s3FileNode.ts b/packages/core/src/awsService/s3/explorer/s3FileNode.ts index 31b6429d265..1d4b3034c08 100644 --- a/packages/core/src/awsService/s3/explorer/s3FileNode.ts +++ b/packages/core/src/awsService/s3/explorer/s3FileNode.ts @@ -12,7 +12,6 @@ import { inspect } from 'util' import { S3BucketNode } from './s3BucketNode' import { S3FolderNode } from './s3FolderNode' import globals from '../../../shared/extensionGlobals' -import { isCloud9 } from '../../../shared/extensionUtilities' import { getIcon } from '../../../shared/icons' import { formatLocalized, getRelativeDate } from '../../../shared/datetime' @@ -42,13 +41,11 @@ export class S3FileNode extends AWSTreeNodeBase implements AWSResourceNode { } this.iconPath = getIcon('vscode-file') this.contextValue = 'awsS3FileNode' - this.command = !isCloud9() - ? { - command: 'aws.s3.openFile', - title: localize('AWS.command.s3.openFile', 'Open File'), - arguments: [this], - } - : undefined + this.command = { + command: 'aws.s3.openFile', + title: localize('AWS.command.s3.openFile', 'Open File'), + arguments: [this], + } } /** diff --git a/packages/core/src/awsexplorer/activation.ts b/packages/core/src/awsexplorer/activation.ts index 5ea7295bf98..224bbadb2fb 100644 --- a/packages/core/src/awsexplorer/activation.ts +++ b/packages/core/src/awsexplorer/activation.ts @@ -110,22 +110,20 @@ export async function activate(args: { ) const amazonQViewNode: ToolView[] = [] - if (!isCloud9()) { - if ( - isExtensionInstalled(VSCODE_EXTENSION_ID.amazonq) || - globals.globalState.get('aws.toolkit.amazonq.dismissed') - ) { - await setContext('aws.toolkit.amazonq.dismissed', true) - } - - // We should create the tree even if it's dismissed, in case the user installs Amazon Q later. - amazonQViewNode.push({ - nodes: [AmazonQNode.instance], - view: 'aws.amazonq.codewhisperer', - refreshCommands: [refreshAmazonQ, refreshAmazonQRootNode], - }) + if ( + isExtensionInstalled(VSCODE_EXTENSION_ID.amazonq) || + globals.globalState.get('aws.toolkit.amazonq.dismissed') + ) { + await setContext('aws.toolkit.amazonq.dismissed', true) } + // We should create the tree even if it's dismissed, in case the user installs Amazon Q later. + amazonQViewNode.push({ + nodes: [AmazonQNode.instance], + view: 'aws.amazonq.codewhisperer', + refreshCommands: [refreshAmazonQ, refreshAmazonQRootNode], + }) + const viewNodes: ToolView[] = [ ...amazonQViewNode, ...codecatalystViewNode, diff --git a/packages/core/src/awsexplorer/regionNode.ts b/packages/core/src/awsexplorer/regionNode.ts index 5e6e0b06d52..a5c5bafe104 100644 --- a/packages/core/src/awsexplorer/regionNode.ts +++ b/packages/core/src/awsexplorer/regionNode.ts @@ -30,7 +30,6 @@ import { getEcsRootNode } from '../awsService/ecs/model' import { compareTreeItems, TreeShim } from '../shared/treeview/utils' import { Ec2ParentNode } from '../awsService/ec2/explorer/ec2ParentNode' import { Ec2Client } from '../shared/clients/ec2Client' -import { isCloud9 } from '../shared/extensionUtilities' import { Experiments } from '../shared/settings' interface ServiceNode { @@ -74,7 +73,6 @@ const serviceCandidates: ServiceNode[] = [ createFn: (regionCode: string) => new EcrNode(new DefaultEcrClient(regionCode)), }, { - when: () => !isCloud9(), serviceId: 'redshift', createFn: (regionCode: string) => new RedshiftNode(new DefaultRedshiftClient(regionCode)), }, diff --git a/packages/core/src/awsexplorer/toolView.ts b/packages/core/src/awsexplorer/toolView.ts index e3417f25521..99d20fbdb3a 100644 --- a/packages/core/src/awsexplorer/toolView.ts +++ b/packages/core/src/awsexplorer/toolView.ts @@ -5,8 +5,6 @@ import * as vscode from 'vscode' import { ResourceTreeDataProvider, TreeNode } from '../shared/treeview/resourceTreeDataProvider' -import { isCloud9 } from '../shared/extensionUtilities' -import { debounce } from '../shared/utilities/functionUtils' export interface ToolView { nodes: TreeNode[] @@ -26,20 +24,8 @@ export function createToolView(viewNode: ToolView): vscode.TreeView { for (const refreshCommand of viewNode.refreshCommands ?? []) { refreshCommand(treeDataProvider) } - const view = vscode.window.createTreeView(viewNode.view, { treeDataProvider }) - // Cloud9 will only refresh when refreshing the entire tree - if (isCloud9()) { - for (const node of viewNode.nodes) { - // Refreshes are delayed to guard against excessive calls to `getTreeItem` and `getChildren` - // The 10ms delay is arbitrary. A single event loop may be good enough in many scenarios. - const refresh = debounce(() => treeDataProvider.refresh(node), 10) - node.onDidChangeTreeItem?.(() => refresh()) - node.onDidChangeChildren?.(() => refresh()) - } - } - - return view + return vscode.window.createTreeView(viewNode.view, { treeDataProvider }) } async function getChildren(roots: TreeNode[]) { diff --git a/packages/core/src/codecatalyst/activation.ts b/packages/core/src/codecatalyst/activation.ts index 3e47dd53879..db5ff9e12f0 100644 --- a/packages/core/src/codecatalyst/activation.ts +++ b/packages/core/src/codecatalyst/activation.ts @@ -16,7 +16,7 @@ import { DevEnvClient } from '../shared/clients/devenvClient' import { watchRestartingDevEnvs } from './reconnect' import { ToolkitPromptSettings } from '../shared/settings' import { dontShow } from '../shared/localizedText' -import { getIdeProperties, isCloud9 } from '../shared/extensionUtilities' +import { getIdeProperties } from '../shared/extensionUtilities' import { Commands } from '../shared/vscode/commands2' import { getCodeCatalystConfig } from '../shared/clients/codecatalystClient' import { isDevenvVscode } from './utils' @@ -78,23 +78,21 @@ export async function activate(ctx: ExtContext): Promise { }) ) - if (!isCloud9()) { - await GitExtension.instance.registerRemoteSourceProvider(remoteSourceProvider).then((disposable) => { - ctx.extensionContext.subscriptions.push(disposable) - }) + await GitExtension.instance.registerRemoteSourceProvider(remoteSourceProvider).then((disposable) => { + ctx.extensionContext.subscriptions.push(disposable) + }) - await GitExtension.instance - .registerCredentialsProvider({ - getCredentials(uri: vscode.Uri) { - if (uri.authority.endsWith(getCodeCatalystConfig().gitHostname)) { - return commands.withClient((client) => authProvider.getCredentialsForGit(client)) - } - }, - }) - .then((disposable) => ctx.extensionContext.subscriptions.push(disposable)) + await GitExtension.instance + .registerCredentialsProvider({ + getCredentials(uri: vscode.Uri) { + if (uri.authority.endsWith(getCodeCatalystConfig().gitHostname)) { + return commands.withClient((client) => authProvider.getCredentialsForGit(client)) + } + }, + }) + .then((disposable) => ctx.extensionContext.subscriptions.push(disposable)) - watchRestartingDevEnvs(ctx, authProvider) - } + watchRestartingDevEnvs(ctx, authProvider) const thisDevenv = (await getThisDevEnv(authProvider))?.unwrapOrElse((err) => { getLogger().error('codecatalyst: failed to get current Dev Enviroment: %s', err) @@ -116,9 +114,10 @@ export async function activate(ctx: ExtContext): Promise { const timeoutMin = thisDevenv.summary.inactivityTimeoutMinutes const timeout = timeoutMin === 0 ? 'never' : `${timeoutMin} min` getLogger().info('codecatalyst: Dev Environment timeout=%s, ides=%O', timeout, thisDevenv.summary.ides) - if (!isCloud9() && thisDevenv && !isDevenvVscode(thisDevenv.summary.ides)) { + if (thisDevenv && !isDevenvVscode(thisDevenv.summary.ides)) { // Prevent Toolkit from reconnecting to a "non-vscode" devenv by actively closing it. // Can happen if devenv is switched to ides="cloud9", etc. + // TODO: Is this needed without cloud9 check? void vscode.commands.executeCommand('workbench.action.remote.close') return } @@ -148,10 +147,6 @@ export async function activate(ctx: ExtContext): Promise { } async function showReadmeFileOnFirstLoad(workspaceState: vscode.ExtensionContext['workspaceState']): Promise { - if (isCloud9()) { - return - } - getLogger().debug('codecatalyst: showReadmeFileOnFirstLoad()') // Check dev env state to see if this is the first time the user has connected to a dev env const isFirstLoad = workspaceState.get('aws.codecatalyst.devEnv.isFirstLoad', true) diff --git a/packages/core/src/codecatalyst/explorer.ts b/packages/core/src/codecatalyst/explorer.ts index a2239d41d89..d20fcc6d37d 100644 --- a/packages/core/src/codecatalyst/explorer.ts +++ b/packages/core/src/codecatalyst/explorer.ts @@ -5,7 +5,6 @@ import * as vscode from 'vscode' import { DevEnvironment } from '../shared/clients/codecatalystClient' -import { isCloud9 } from '../shared/extensionUtilities' import { addColor, getIcon } from '../shared/icons' import { TreeNode } from '../shared/treeview/resourceTreeDataProvider' import { Commands } from '../shared/vscode/commands2' @@ -21,7 +20,6 @@ export const learnMoreCommand = Commands.declare('aws.learnMore', () => async (d return openUrl(docsUrl) }) -// Only used in rare cases on C9 export const reauth = Commands.declare( '_aws.codecatalyst.reauthenticate', () => async (conn: SsoConnection, authProvider: CodeCatalystAuthenticationProvider) => { @@ -37,7 +35,7 @@ export const onboardCommand = Commands.declare( ) async function getLocalCommands(auth: CodeCatalystAuthenticationProvider) { - const docsUrl = isCloud9() ? codecatalyst.docs.cloud9.overview : codecatalyst.docs.vscode.overview + const docsUrl = codecatalyst.docs.overview const learnMoreNode = learnMoreCommand.build(docsUrl).asTreeNode({ label: 'Learn more about CodeCatalyst', iconPath: getIcon('vscode-question'), @@ -75,15 +73,6 @@ async function getLocalCommands(auth: CodeCatalystAuthenticationProvider) { ] } - if (isCloud9()) { - const item = reauth.build(auth.activeConnection, auth).asTreeNode({ - label: 'Failed to get the current Dev Environment. Click to try again.', - iconPath: addColor(getIcon(`vscode-error`), 'notificationsErrorIcon.foreground'), - }) - - return [item] - } - return [ CodeCatalystCommands.declared.cloneRepo.build().asTreeNode({ label: 'Clone Repository', diff --git a/packages/core/src/codecatalyst/model.ts b/packages/core/src/codecatalyst/model.ts index 768a97890ee..d49d8780cde 100644 --- a/packages/core/src/codecatalyst/model.ts +++ b/packages/core/src/codecatalyst/model.ts @@ -35,49 +35,17 @@ export type DevEnvironmentId = Pick export const connectScriptPrefix = 'codecatalyst_connect' export const docs = { - vscode: { - main: vscode.Uri.parse('https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/codecatalyst-service'), - overview: vscode.Uri.parse( - 'https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/codecatalyst-overview.html' - ), - devenv: vscode.Uri.parse( - 'https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/codecatalyst-devenvironment.html' - ), - setup: vscode.Uri.parse( - 'https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/codecatalyst-setup.html' - ), - troubleshoot: vscode.Uri.parse( - 'https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/codecatalyst-troubleshoot.html' - ), - }, - cloud9: { - // Working with Amazon CodeCatalyst - main: vscode.Uri.parse('https://docs.aws.amazon.com/cloud9/latest/user-guide/ide-toolkits-cloud9'), - // Getting Started - overview: vscode.Uri.parse( - 'https://docs.aws.amazon.com/cloud9/latest/user-guide/ide-toolkits-cloud9-getstarted' - ), - // Opening Dev Environment settings in AWS Cloud9 - settings: vscode.Uri.parse('https://docs.aws.amazon.com/cloud9/latest/user-guide/ide-toolkits-settings-cloud9'), - // Resuming a Dev Environment in AWS Cloud9 - devenv: vscode.Uri.parse('https://docs.aws.amazon.com/cloud9/latest/user-guide/ide-toolkits-resume-cloud9'), - // Creating a Dev Environment in AWS Cloud9 - devenvCreate: vscode.Uri.parse( - 'https://docs.aws.amazon.com/cloud9/latest/user-guide/ide-toolkits-create-cloud9' - ), - // Stopping a Dev Environment in AWS Cloud9 - devenvStop: vscode.Uri.parse('https://docs.aws.amazon.com/cloud9/latest/user-guide/ide-toolkits-stop-cloud9'), - // Deleting a Dev Environment in AWS Cloud9 - devenvDelete: vscode.Uri.parse( - 'https://docs.aws.amazon.com/cloud9/latest/user-guide/ide-toolkits-delete-cloud9' - ), - // Editing the repo devfile for a Dev Environment in AWS Cloud9 - devfileEdit: vscode.Uri.parse( - 'https://docs.aws.amazon.com/cloud9/latest/user-guide/ide-toolkits-edit-devfile-cloud9' - ), - // Cloning a repository in AWS Cloud9 - cloneRepo: vscode.Uri.parse('https://docs.aws.amazon.com/cloud9/latest/user-guide/ide-toolkits-clone-cloud9'), - }, + main: vscode.Uri.parse('https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/codecatalyst-service'), + overview: vscode.Uri.parse( + 'https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/codecatalyst-overview.html' + ), + devenv: vscode.Uri.parse( + 'https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/codecatalyst-devenvironment.html' + ), + setup: vscode.Uri.parse('https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/codecatalyst-setup.html'), + troubleshoot: vscode.Uri.parse( + 'https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/codecatalyst-troubleshoot.html' + ), } as const export function getCodeCatalystSsmEnv(region: string, ssmPath: string, devenv: DevEnvironmentId): NodeJS.ProcessEnv { diff --git a/packages/core/src/codecatalyst/reconnect.ts b/packages/core/src/codecatalyst/reconnect.ts index 63a932c7d1a..ecedbd3eb04 100644 --- a/packages/core/src/codecatalyst/reconnect.ts +++ b/packages/core/src/codecatalyst/reconnect.ts @@ -180,10 +180,9 @@ async function pollDevEnvs( // Don't watch this devenv, it is already being re-opened in SSH. delete devenvs[id] } else if (!isDevenvVscode(metadata.ides)) { - // Technically vscode _can_ connect to a ideRuntime=jetbrains/cloud9 devenv, but - // we refuse to anyway so that the experience is consistent with other IDEs - // (jetbrains/cloud9) which are not capable of connecting to a devenv that lacks - // their runtime/bootstrap files. + // Technically vscode _can_ connect to a ideRuntime=jetbrains devenv, but + // we refuse to anyway so that the experience is consistent since that devenv + // is not capable of connecting to a devenv that lacks their runtime/bootstrap files. const ide = metadata.ides?.[0] const toIde = ide ? ` to "${ide.name}"` : '' progress.report({ message: `Dev Environment ${devenvName} was switched${toIde}` }) diff --git a/packages/core/src/codecatalyst/vue/configure/backend.ts b/packages/core/src/codecatalyst/vue/configure/backend.ts index e2ff928f2c6..e5dd360cac7 100644 --- a/packages/core/src/codecatalyst/vue/configure/backend.ts +++ b/packages/core/src/codecatalyst/vue/configure/backend.ts @@ -25,7 +25,6 @@ import { updateDevfileCommand } from '../../devfile' import { showViewLogsMessage } from '../../../shared/utilities/messages' import { isLongReconnect, removeReconnectionInformation, saveReconnectionInformation } from '../../reconnect' import { CodeCatalystClient, DevEnvironment } from '../../../shared/clients/codecatalystClient' -import { isCloud9 } from '../../../shared/extensionUtilities' const localize = nls.loadMessageBundle() @@ -165,7 +164,7 @@ export async function showConfigureDevEnv( activePanel ??= new Panel(ctx, client, devenv, commands) const webview = await activePanel.show({ title: localize('AWS.view.configureDevEnv.title', 'Dev Environment Settings'), - viewColumn: isCloud9() ? vscode.ViewColumn.One : vscode.ViewColumn.Active, + viewColumn: vscode.ViewColumn.Active, }) if (!subscriptions) { diff --git a/packages/core/src/codecatalyst/vue/create/backend.ts b/packages/core/src/codecatalyst/vue/create/backend.ts index d2531b12923..bdf49419243 100644 --- a/packages/core/src/codecatalyst/vue/create/backend.ts +++ b/packages/core/src/codecatalyst/vue/create/backend.ts @@ -29,7 +29,6 @@ import { isThirdPartyRepo, } from '../../../shared/clients/codecatalystClient' import { CancellationError } from '../../../shared/utilities/timeoutUtils' -import { isCloud9 } from '../../../shared/extensionUtilities' import { telemetry } from '../../../shared/telemetry/telemetry' import { isNonNullable } from '../../../shared/utilities/tsUtils' import { createOrgPrompter, createProjectPrompter } from '../../wizards/selectResource' @@ -267,7 +266,7 @@ export async function showCreateDevEnv( const webview = await activePanel!.show({ title: localize('AWS.view.createDevEnv.title', 'Create a CodeCatalyst Dev Environment'), - viewColumn: isCloud9() ? vscode.ViewColumn.One : vscode.ViewColumn.Active, + viewColumn: vscode.ViewColumn.Active, }) if (!subscriptions) { diff --git a/packages/core/src/codecatalyst/wizards/selectResource.ts b/packages/core/src/codecatalyst/wizards/selectResource.ts index d1c3de3328b..54e3bb20951 100644 --- a/packages/core/src/codecatalyst/wizards/selectResource.ts +++ b/packages/core/src/codecatalyst/wizards/selectResource.ts @@ -4,7 +4,6 @@ */ import * as vscode from 'vscode' -import { isCloud9 } from '../../shared/extensionUtilities' import * as codecatalyst from '../../shared/clients/codecatalystClient' import { createCommonButtons, createRefreshButton } from '../../shared/ui/buttons' import { @@ -104,7 +103,7 @@ function createResourcePrompter( export function createOrgPrompter( client: codecatalyst.CodeCatalystClient ): QuickPickPrompter { - const helpUri = isCloud9() ? docs.cloud9.main : docs.vscode.main + const helpUri = docs.main return createResourcePrompter(client.listSpaces(), helpUri, { title: 'Select a CodeCatalyst Organization', placeholder: 'Search for an Organization', @@ -115,7 +114,7 @@ export function createProjectPrompter( client: codecatalyst.CodeCatalystClient, spaceName?: codecatalyst.CodeCatalystOrg['name'] ): QuickPickPrompter { - const helpUri = isCloud9() ? docs.cloud9.main : docs.vscode.main + const helpUri = docs.main const projects = spaceName ? client.listProjects({ spaceName }) : client.listResources('project') return createResourcePrompter(projects, helpUri, { @@ -129,7 +128,7 @@ export function createRepoPrompter( proj?: codecatalyst.CodeCatalystProject, thirdParty?: boolean ): QuickPickPrompter { - const helpUri = isCloud9() ? docs.cloud9.cloneRepo : docs.vscode.main + const helpUri = docs.main const repos = proj ? client.listSourceRepositories({ spaceName: proj.org.name, projectName: proj.name }, thirdParty) : client.listResources('repo', thirdParty) @@ -144,7 +143,7 @@ export function createDevEnvPrompter( client: codecatalyst.CodeCatalystClient, proj?: codecatalyst.CodeCatalystProject ): QuickPickPrompter { - const helpUri = isCloud9() ? docs.cloud9.devenv : docs.vscode.devenv + const helpUri = docs.devenv const envs = proj ? client.listDevEnvironments(proj) : client.listResources('devEnvironment') const filtered = envs.map((arr) => arr.filter((env) => isDevenvVscode(env.ides))) const isData = (obj: T | DataQuickPickItem['data']): obj is T => { diff --git a/packages/core/src/codewhisperer/activation.ts b/packages/core/src/codewhisperer/activation.ts index 72516c06537..17934f2fe38 100644 --- a/packages/core/src/codewhisperer/activation.ts +++ b/packages/core/src/codewhisperer/activation.ts @@ -9,7 +9,6 @@ import { getTabSizeSetting } from '../shared/utilities/editorUtilities' import { KeyStrokeHandler } from './service/keyStrokeHandler' import * as EditorContext from './util/editorContext' import * as CodeWhispererConstants from './models/constants' -import { getCompletionItems } from './service/completionProvider' import { vsCodeState, ConfigurationEntry, @@ -22,15 +21,12 @@ import { } from './models/model' import { invokeRecommendation } from './commands/invokeRecommendation' import { acceptSuggestion } from './commands/onInlineAcceptance' -import { resetIntelliSenseState } from './util/globalStateUtil' import { CodeWhispererSettings } from './util/codewhispererSettings' import { ExtContext } from '../shared/extensions' -import { TextEditorSelectionChangeKind } from 'vscode' import { CodeWhispererTracker } from './tracker/codewhispererTracker' import * as codewhispererClient from './client/codewhisperer' import { runtimeLanguageContext } from './util/runtimeLanguageContext' import { getLogger } from '../shared/logger' -import { isCloud9 } from '../shared/extensionUtilities' import { enableCodeSuggestions, toggleCodeSuggestions, @@ -113,14 +109,6 @@ export async function activate(context: ExtContext): Promise { const auth = AuthUtil.instance auth.initCodeWhispererHooks() - /** - * Enable essential intellisense default settings for AWS C9 IDE - */ - - if (isCloud9()) { - await enableDefaultConfigCloud9() - } - // TODO: is this indirection useful? registerDeclaredCommands( context.extensionContext.subscriptions, @@ -132,7 +120,9 @@ export async function activate(context: ExtContext): Promise { * CodeWhisperer security panel */ const securityPanelViewProvider = new SecurityPanelViewProvider(context.extensionContext) - activateSecurityScan() + context.extensionContext.subscriptions.push( + vscode.window.registerWebviewViewProvider(SecurityPanelViewProvider.viewType, securityPanelViewProvider) + ) // TODO: this is already done in packages/core/src/extensionCommon.ts, why doesn't amazonq use that? registerCommandErrorHandler((info, error) => { @@ -490,22 +480,6 @@ export async function activate(context: ExtContext): Promise { }) } - function activateSecurityScan() { - context.extensionContext.subscriptions.push( - vscode.window.registerWebviewViewProvider(SecurityPanelViewProvider.viewType, securityPanelViewProvider) - ) - - context.extensionContext.subscriptions.push( - vscode.window.onDidChangeActiveTextEditor((editor) => { - if (isCloud9()) { - if (editor) { - securityPanelViewProvider.setDecoration(editor, editor.document.uri) - } - } - }) - ) - } - function getAutoTriggerStatus(): boolean { return CodeSuggestionsState.instance.isSuggestionsEnabled() } @@ -526,9 +500,7 @@ export async function activate(context: ExtContext): Promise { } } - if (isCloud9()) { - setSubscriptionsforCloud9() - } else if (isInlineCompletionEnabled()) { + if (isInlineCompletionEnabled()) { await setSubscriptionsforInlineCompletion() await AuthUtil.instance.setVscodeContextProps() } @@ -592,80 +564,6 @@ export async function activate(context: ExtContext): Promise { ) } - function setSubscriptionsforCloud9() { - /** - * Manual trigger - */ - context.extensionContext.subscriptions.push( - vscode.languages.registerCompletionItemProvider([...CodeWhispererConstants.platformLanguageIds], { - async provideCompletionItems( - document: vscode.TextDocument, - position: vscode.Position, - token: vscode.CancellationToken, - context: vscode.CompletionContext - ) { - const completionList = new vscode.CompletionList(getCompletionItems(document, position), false) - return completionList - }, - }), - /** - * Automated trigger - */ - vscode.workspace.onDidChangeTextDocument(async (e) => { - const editor = vscode.window.activeTextEditor - if (!editor) { - return - } - if (e.document !== editor.document) { - return - } - if (!runtimeLanguageContext.isLanguageSupported(e.document)) { - return - } - /** - * CodeWhisperer security panel dynamic handling - */ - securityPanelViewProvider.disposeSecurityPanelItem(e, editor) - CodeWhispererCodeCoverageTracker.getTracker(e.document.languageId)?.countTotalTokens(e) - - if (e.contentChanges.length === 0 || vsCodeState.isCodeWhispererEditing) { - return - } - /** - * Important: Doing this sleep(10) is to make sure - * 1. this event is processed by vs code first - * 2. editor.selection.active has been successfully updated by VS Code - * Then this event can be processed by our code. - */ - await sleep(CodeWhispererConstants.vsCodeCursorUpdateDelay) - await KeyStrokeHandler.instance.processKeyStroke(e, editor, client, await getConfigEntry()) - }), - - /** - * On intelliSense recommendation rejection, reset set intelli sense is active state - * Maintaining this variable because VS Code does not expose official intelliSense isActive API - */ - vscode.window.onDidChangeVisibleTextEditors(async (e) => { - resetIntelliSenseState(true, getAutoTriggerStatus(), RecommendationHandler.instance.isValidResponse()) - }), - vscode.window.onDidChangeActiveTextEditor(async (e) => { - resetIntelliSenseState(true, getAutoTriggerStatus(), RecommendationHandler.instance.isValidResponse()) - }), - vscode.window.onDidChangeTextEditorSelection(async (e) => { - if (e.kind === TextEditorSelectionChangeKind.Mouse) { - resetIntelliSenseState( - true, - getAutoTriggerStatus(), - RecommendationHandler.instance.isValidResponse() - ) - } - }), - vscode.workspace.onDidSaveTextDocument(async (e) => { - resetIntelliSenseState(true, getAutoTriggerStatus(), RecommendationHandler.instance.isValidResponse()) - }) - ) - } - void FeatureConfigProvider.instance.fetchFeatureConfigs().catch((error) => { getLogger().error('Failed to fetch feature configs - %s', error) }) @@ -708,19 +606,6 @@ export async function shutdown() { await CodeWhispererTracker.getTracker().shutdown() } -export async function enableDefaultConfigCloud9() { - const editorSettings = vscode.workspace.getConfiguration('editor') - try { - await editorSettings.update('suggest.showMethods', true, vscode.ConfigurationTarget.Global) - // suggest.preview is available in vsc 1.57+ - await editorSettings.update('suggest.preview', true, vscode.ConfigurationTarget.Global) - await editorSettings.update('acceptSuggestionOnEnter', 'on', vscode.ConfigurationTarget.Global) - await editorSettings.update('snippetSuggestions', 'top', vscode.ConfigurationTarget.Global) - } catch (error) { - getLogger().error('amazonq: Failed to update user settings %O', error) - } -} - function toggleIssuesVisibility(visibleCondition: (issue: CodeScanIssue, filePath: string) => boolean) { const updatedIssues: AggregatedCodeScanIssue[] = SecurityIssueProvider.instance.issues.map((group) => ({ ...group, diff --git a/packages/core/src/codewhisperer/commands/basicCommands.ts b/packages/core/src/codewhisperer/commands/basicCommands.ts index 98aaff83800..3a614b003f0 100644 --- a/packages/core/src/codewhisperer/commands/basicCommands.ts +++ b/packages/core/src/codewhisperer/commands/basicCommands.ts @@ -27,7 +27,6 @@ import { connectToEnterpriseSso, getStartUrl } from '../util/getStartUrl' import { showCodeWhispererConnectionPrompt } from '../util/showSsoPrompt' import { ReferenceLogViewProvider } from '../service/referenceLogViewProvider' import { AuthUtil } from '../util/authUtil' -import { isCloud9 } from '../../shared/extensionUtilities' import { getLogger } from '../../shared/logger' import { isExtensionActive, isExtensionInstalled, localize, openUrl } from '../../shared/utilities/vsCodeUtils' import { @@ -107,9 +106,7 @@ export const enableCodeSuggestions = Commands.declare( await setContext('aws.codewhisperer.connected', true) await setContext('aws.codewhisperer.connectionExpired', false) vsCodeState.isFreeTierLimitReached = false - if (!isCloud9()) { - await vscode.commands.executeCommand('aws.amazonq.refreshStatusBar') - } + await vscode.commands.executeCommand('aws.amazonq.refreshStatusBar') } ) diff --git a/packages/core/src/codewhisperer/commands/invokeRecommendation.ts b/packages/core/src/codewhisperer/commands/invokeRecommendation.ts index 508639ac45b..37fcb965774 100644 --- a/packages/core/src/codewhisperer/commands/invokeRecommendation.ts +++ b/packages/core/src/codewhisperer/commands/invokeRecommendation.ts @@ -7,7 +7,6 @@ import * as vscode from 'vscode' import { vsCodeState, ConfigurationEntry } from '../models/model' import { resetIntelliSenseState } from '../util/globalStateUtil' import { DefaultCodeWhispererClient } from '../client/codewhisperer' -import { isCloud9 } from '../../shared/extensionUtilities' import { RecommendationHandler } from '../service/recommendationHandler' import { session } from '../util/codeWhispererSession' import { RecommendationService } from '../service/recommendationService' @@ -21,17 +20,7 @@ export async function invokeRecommendation( client: DefaultCodeWhispererClient, config: ConfigurationEntry ) { - if (!config.isManualTriggerEnabled) { - return - } - /** - * IntelliSense in Cloud9 needs editor.suggest.showMethods - */ - if (!config.isShowMethodsEnabled && isCloud9()) { - void vscode.window.showWarningMessage('Turn on "editor.suggest.showMethods" to use Amazon Q inline suggestions') - return - } - if (!editor) { + if (!editor || !config.isManualTriggerEnabled) { return } diff --git a/packages/core/src/codewhisperer/commands/onAcceptance.ts b/packages/core/src/codewhisperer/commands/onAcceptance.ts index 7ed36cde581..e13c197cefd 100644 --- a/packages/core/src/codewhisperer/commands/onAcceptance.ts +++ b/packages/core/src/codewhisperer/commands/onAcceptance.ts @@ -9,7 +9,6 @@ import { runtimeLanguageContext } from '../util/runtimeLanguageContext' import { CodeWhispererTracker } from '../tracker/codewhispererTracker' import { CodeWhispererCodeCoverageTracker } from '../tracker/codewhispererCodeCoverageTracker' import { getLogger } from '../../shared/logger/logger' -import { isCloud9 } from '../../shared/extensionUtilities' import { handleExtraBrackets } from '../util/closingBracketUtil' import { RecommendationHandler } from '../service/recommendationHandler' import { ReferenceLogViewProvider } from '../service/referenceLogViewProvider' @@ -30,7 +29,7 @@ export async function onAcceptance(acceptanceEntry: OnRecommendationAcceptanceEn path.extname(acceptanceEntry.editor.document.fileName) ) const start = acceptanceEntry.range.start - const end = isCloud9() ? acceptanceEntry.editor.selection.active : acceptanceEntry.range.end + const end = acceptanceEntry.range.end // codewhisperer will be doing editing while formatting. // formatting should not trigger consoals auto trigger @@ -45,13 +44,8 @@ export async function onAcceptance(acceptanceEntry: OnRecommendationAcceptanceEn } // move cursor to end of suggestion before doing code format // after formatting, the end position will still be editor.selection.active - if (!isCloud9()) { - acceptanceEntry.editor.selection = new vscode.Selection(end, end) - } + acceptanceEntry.editor.selection = new vscode.Selection(end, end) - if (isCloud9()) { - vsCodeState.isIntelliSenseActive = false - } vsCodeState.isCodeWhispererEditing = false CodeWhispererTracker.getTracker().enqueue({ time: new Date(), diff --git a/packages/core/src/codewhisperer/commands/startSecurityScan.ts b/packages/core/src/codewhisperer/commands/startSecurityScan.ts index 698b9792187..ce91b0d6edd 100644 --- a/packages/core/src/codewhisperer/commands/startSecurityScan.ts +++ b/packages/core/src/codewhisperer/commands/startSecurityScan.ts @@ -6,7 +6,6 @@ import * as vscode from 'vscode' import * as nls from 'vscode-nls' import { ArtifactMap, DefaultCodeWhispererClient } from '../client/codewhisperer' -import { isCloud9 } from '../../shared/extensionUtilities' import { initSecurityScanRender } from '../service/diagnosticsProvider' import { SecurityPanelViewProvider } from '../views/securityPanelViewProvider' import { getLogger } from '../../shared/logger' @@ -291,16 +290,7 @@ export async function startSecurityScan( scanUuid ) } else { - showSecurityScanResults( - securityPanelViewProvider, - securityRecommendationCollection, - editor, - context, - scope, - zipMetadata, - total, - scanUuid - ) + showSecurityScanResults(securityRecommendationCollection, editor, context, scope, zipMetadata, total) } TelemetryHelper.instance.sendCodeScanSucceededEvent( codeScanTelemetryEntry.codewhispererLanguage, @@ -387,28 +377,22 @@ export async function startSecurityScan( } export function showSecurityScanResults( - securityPanelViewProvider: SecurityPanelViewProvider, securityRecommendationCollection: AggregatedCodeScanIssue[], editor: vscode.TextEditor | undefined, context: vscode.ExtensionContext, scope: CodeWhispererConstants.CodeAnalysisScope, zipMetadata: ZipMetadata, - totalIssues: number, - scanUuid: string | undefined + totalIssues: number ) { - if (isCloud9()) { - securityPanelViewProvider.addLines(securityRecommendationCollection, editor) - void vscode.commands.executeCommand('workbench.view.extension.aws-codewhisperer-security-panel') - } else { - initSecurityScanRender(securityRecommendationCollection, context, editor, scope) - if ( - totalIssues > 0 && - (scope === CodeWhispererConstants.CodeAnalysisScope.PROJECT || - scope === CodeWhispererConstants.CodeAnalysisScope.FILE_ON_DEMAND) - ) { - SecurityIssuesTree.instance.focus() - } + initSecurityScanRender(securityRecommendationCollection, context, editor, scope) + if ( + totalIssues > 0 && + (scope === CodeWhispererConstants.CodeAnalysisScope.PROJECT || + scope === CodeWhispererConstants.CodeAnalysisScope.FILE_ON_DEMAND) + ) { + SecurityIssuesTree.instance.focus() } + if (scope === CodeWhispererConstants.CodeAnalysisScope.PROJECT) { populateCodeScanLogStream(zipMetadata.scannedFiles) } @@ -424,35 +408,32 @@ export function showScanResultsInChat( totalIssues: number, scanUuid: string | undefined ) { - if (isCloud9()) { - securityPanelViewProvider.addLines(securityRecommendationCollection, editor) - void vscode.commands.executeCommand('workbench.view.extension.aws-codewhisperer-security-panel') - } else { - const tabID = ChatSessionManager.Instance.getSession().tabID - const eventData = { - message: 'Show Findings in the Chat panel', - totalIssues, - securityRecommendationCollection, - fileName: scope === CodeAnalysisScope.FILE_ON_DEMAND ? [...zipMetadata.scannedFiles][0] : undefined, - tabID, - scope, - scanUuid, - } - switch (scope) { - case CodeAnalysisScope.PROJECT: - codeScanState.getChatControllers()?.showSecurityScan.fire(eventData) - break - case CodeAnalysisScope.FILE_ON_DEMAND: - onDemandFileScanState.getChatControllers()?.showSecurityScan.fire(eventData) - break - default: - break - } - initSecurityScanRender(securityRecommendationCollection, context, editor, scope) - if (totalIssues > 0) { - SecurityIssuesTree.instance.focus() - } + const tabID = ChatSessionManager.Instance.getSession().tabID + const eventData = { + message: 'Show Findings in the Chat panel', + totalIssues, + securityRecommendationCollection, + fileName: scope === CodeAnalysisScope.FILE_ON_DEMAND ? [...zipMetadata.scannedFiles][0] : undefined, + tabID, + scope, + scanUuid, + } + switch (scope) { + case CodeAnalysisScope.PROJECT: + codeScanState.getChatControllers()?.showSecurityScan.fire(eventData) + break + case CodeAnalysisScope.FILE_ON_DEMAND: + onDemandFileScanState.getChatControllers()?.showSecurityScan.fire(eventData) + break + default: + break } + + initSecurityScanRender(securityRecommendationCollection, context, editor, scope) + if (totalIssues > 0) { + SecurityIssuesTree.instance.focus() + } + populateCodeScanLogStream(zipMetadata.scannedFiles) if (scope === CodeAnalysisScope.PROJECT) { showScanCompletedNotification(totalIssues, zipMetadata.scannedFiles) diff --git a/packages/core/src/codewhisperer/models/constants.ts b/packages/core/src/codewhisperer/models/constants.ts index a811022ac97..f0ff34dcb02 100644 --- a/packages/core/src/codewhisperer/models/constants.ts +++ b/packages/core/src/codewhisperer/models/constants.ts @@ -98,6 +98,7 @@ export const completionDetail = 'Amazon Q' export const codewhisperer = 'Amazon Q' // use vscode languageId here / Supported languages +// TODO: Dropped Cloud9 support - do we need Cloud9-commented entries here? export const platformLanguageIds = [ 'java', 'python', @@ -305,7 +306,9 @@ export const securityScanLanguageIds = [ 'csharp', 'go', 'ruby', - 'golang', // Cloud9 reports Go files with this language-id + // Cloud9 reports Go files with this language-id + // TODO: Dropped Cloud9 support - is this still needed? + 'golang', 'json', 'yaml', 'tf', diff --git a/packages/core/src/codewhisperer/models/model.ts b/packages/core/src/codewhisperer/models/model.ts index 5c5e945b14b..d8eea5a018c 100644 --- a/packages/core/src/codewhisperer/models/model.ts +++ b/packages/core/src/codewhisperer/models/model.ts @@ -1152,12 +1152,6 @@ export class TransformByQStoppedError extends ToolkitError { } } -export enum Cloud9AccessState { - NoAccess, - RequestedAccess, - HasAccess, -} - export interface TransformationCandidateProject { name: string path: string diff --git a/packages/core/src/codewhisperer/service/importAdderProvider.ts b/packages/core/src/codewhisperer/service/importAdderProvider.ts index 717373148c4..98b7c36adfd 100644 --- a/packages/core/src/codewhisperer/service/importAdderProvider.ts +++ b/packages/core/src/codewhisperer/service/importAdderProvider.ts @@ -4,7 +4,6 @@ */ import * as vscode from 'vscode' -import { isCloud9 } from '../../shared/extensionUtilities' import { Recommendation } from '../client/codewhisperer' import { CodeWhispererSettings } from '../util/codewhispererSettings' import { findLineToInsertImportStatement } from '../util/importAdderUtil' @@ -74,8 +73,7 @@ export class ImportAdderProvider implements vscode.CodeLensProvider { private isNotEnabled(languageId: string): boolean { return ( !this.supportedLanguages.includes(languageId) || - !CodeWhispererSettings.instance.isImportRecommendationEnabled() || - isCloud9() + !CodeWhispererSettings.instance.isImportRecommendationEnabled() ) } diff --git a/packages/core/src/codewhisperer/service/keyStrokeHandler.ts b/packages/core/src/codewhisperer/service/keyStrokeHandler.ts index 623f9aaa808..d32e875e8a4 100644 --- a/packages/core/src/codewhisperer/service/keyStrokeHandler.ts +++ b/packages/core/src/codewhisperer/service/keyStrokeHandler.ts @@ -8,7 +8,6 @@ import { DefaultCodeWhispererClient } from '../client/codewhisperer' import * as CodeWhispererConstants from '../models/constants' import { ConfigurationEntry } from '../models/model' import { getLogger } from '../../shared/logger' -import { isCloud9 } from '../../shared/extensionUtilities' import { RecommendationHandler } from './recommendationHandler' import { CodewhispererAutomatedTriggerType } from '../../shared/telemetry/telemetry' import { getTabSizeSetting } from '../../shared/utilities/editorUtilities' @@ -76,9 +75,6 @@ export class KeyStrokeHandler { } public shouldTriggerIdleTime(): boolean { - if (isCloud9() && RecommendationService.instance.isRunning) { - return false - } if (isInlineCompletionEnabled() && RecommendationService.instance.isRunning) { return false } @@ -101,14 +97,6 @@ export class KeyStrokeHandler { return } - // In Cloud9, do not auto trigger when - // 1. The input is from IntelliSense acceptance event - // 2. The input is from copy and paste some code - // event.contentChanges[0].text.length > 1 is a close estimate of 1 and 2 - if (isCloud9() && event.contentChanges.length > 0 && event.contentChanges[0].text.length > 1) { - return - } - const { rightFileContent } = extractContextForCodeWhisperer(editor) const rightContextLines = rightFileContent.split(/\r?\n/) const rightContextAtCurrentLine = rightContextLines[0] @@ -259,7 +247,7 @@ export class DefaultDocumentChangedType extends DocumentChangedType { // single line && single place reformat should consist of space chars only return DocumentChangedSource.Reformatting } else { - return isCloud9() ? DocumentChangedSource.RegularKey : DocumentChangedSource.Unknown + return DocumentChangedSource.Unknown } } diff --git a/packages/core/src/codewhisperer/service/recommendationHandler.ts b/packages/core/src/codewhisperer/service/recommendationHandler.ts index 76efdbc6fe0..1f5096ad1cc 100644 --- a/packages/core/src/codewhisperer/service/recommendationHandler.ts +++ b/packages/core/src/codewhisperer/service/recommendationHandler.ts @@ -14,7 +14,6 @@ import { AWSError } from 'aws-sdk' import { isAwsError } from '../../shared/errors' import { TelemetryHelper } from '../util/telemetryHelper' import { getLogger } from '../../shared/logger' -import { isCloud9 } from '../../shared/extensionUtilities' import { hasVendedIamCredentials } from '../../auth/auth' import { asyncCallWithTimeout, @@ -64,9 +63,7 @@ const rejectCommand = Commands.declare('aws.amazonq.rejectCodeSuggestion', () => traceId: TelemetryHelper.instance.traceId, }) - if (!isCloud9('any')) { - await vscode.commands.executeCommand('editor.action.inlineSuggest.hide') - } + await vscode.commands.executeCommand('editor.action.inlineSuggest.hide') RecommendationHandler.instance.reportUserDecisions(-1) await Commands.tryExecute('aws.amazonq.refreshAnnotation') }) @@ -499,9 +496,7 @@ export class RecommendationHandler { session.suggestionStates, session.requestContext.supplementalMetadata ) - if (isCloud9('any')) { - this.clearRecommendations() - } else if (isInlineCompletionEnabled()) { + if (isInlineCompletionEnabled()) { this.clearInlineCompletionStates().catch((e) => { getLogger().error('clearInlineCompletionStates failed: %s', (e as Error).message) }) diff --git a/packages/core/src/codewhisperer/service/recommendationService.ts b/packages/core/src/codewhisperer/service/recommendationService.ts index 0a9a4e3c034..1da76995781 100644 --- a/packages/core/src/codewhisperer/service/recommendationService.ts +++ b/packages/core/src/codewhisperer/service/recommendationService.ts @@ -3,17 +3,13 @@ * SPDX-License-Identifier: Apache-2.0 */ import * as vscode from 'vscode' -import { ConfigurationEntry, GetRecommendationsResponse, vsCodeState } from '../models/model' -import { isCloud9 } from '../../shared/extensionUtilities' +import { ConfigurationEntry, GetRecommendationsResponse } from '../models/model' import { isInlineCompletionEnabled } from '../util/commonUtil' import { CodewhispererAutomatedTriggerType, CodewhispererTriggerType, telemetry, } from '../../shared/telemetry/telemetry' -import { AuthUtil } from '../util/authUtil' -import { isIamConnection } from '../../auth/connection' -import { RecommendationHandler } from '../service/recommendationHandler' import { InlineCompletionService } from '../service/inlineCompletionService' import { ClassifierTrigger } from './classifierTrigger' import { DefaultCodeWhispererClient } from '../client/codewhisperer' @@ -81,67 +77,7 @@ export class RecommendationService { const traceId = telemetry.attributes?.traceId ?? randomUUID() TelemetryHelper.instance.setTraceId(traceId) await telemetry.withTraceId(async () => { - if (isCloud9('any')) { - // C9 manual trigger key alt/option + C is ALWAYS enabled because the VSC version C9 is on doesn't support setContextKey which is used for CODEWHISPERER_ENABLED - // therefore we need a connection check if there is ANY connection(regardless of the connection's state) connected to CodeWhisperer on C9 - if (triggerType === 'OnDemand' && !AuthUtil.instance.isConnected()) { - return - } - - RecommendationHandler.instance.checkAndResetCancellationTokens() - vsCodeState.isIntelliSenseActive = false - this._isRunning = true - let response: GetRecommendationsResponse = { - result: 'Failed', - errorMessage: undefined, - recommendationCount: 0, - } - - try { - this._onSuggestionActionEvent.fire({ - editor: editor, - isRunning: true, - triggerType: triggerType, - response: undefined, - }) - - if (isCloud9('classic') || isIamConnection(AuthUtil.instance.conn)) { - response = await RecommendationHandler.instance.getRecommendations( - client, - editor, - triggerType, - config, - autoTriggerType, - false - ) - } else { - if (AuthUtil.instance.isConnectionExpired()) { - await AuthUtil.instance.showReauthenticatePrompt() - } - response = await RecommendationHandler.instance.getRecommendations( - client, - editor, - triggerType, - config, - autoTriggerType, - true - ) - } - if (RecommendationHandler.instance.canShowRecommendationInIntelliSense(editor, true, response)) { - await vscode.commands.executeCommand('editor.action.triggerSuggest').then(() => { - vsCodeState.isIntelliSenseActive = true - }) - } - } finally { - this._isRunning = false - this._onSuggestionActionEvent.fire({ - editor: editor, - isRunning: false, - triggerType: triggerType, - response: response, - }) - } - } else if (isInlineCompletionEnabled()) { + if (isInlineCompletionEnabled()) { if (triggerType === 'OnDemand') { ClassifierTrigger.instance.recordClassifierResultForManualTrigger(editor) } diff --git a/packages/core/src/codewhisperer/service/referenceLogViewProvider.ts b/packages/core/src/codewhisperer/service/referenceLogViewProvider.ts index 2a2fe867321..9ec20b8cb44 100644 --- a/packages/core/src/codewhisperer/service/referenceLogViewProvider.ts +++ b/packages/core/src/codewhisperer/service/referenceLogViewProvider.ts @@ -9,7 +9,6 @@ import { LicenseUtil } from '../util/licenseUtil' import * as CodeWhispererConstants from '../models/constants' import { CodeWhispererSettings } from '../util/codewhispererSettings' import globals from '../../shared/extensionGlobals' -import { isCloud9 } from '../../shared/extensionUtilities' import { AuthUtil } from '../util/authUtil' import { session } from '../util/codeWhispererSession' @@ -127,22 +126,9 @@ export class ReferenceLogViewProvider implements vscode.WebviewViewProvider { } } - let csp = '' - if (isCloud9()) { - csp = `` - } return ` - ${csp} diff --git a/packages/core/src/codewhisperer/util/authUtil.ts b/packages/core/src/codewhisperer/util/authUtil.ts index 461f262d34d..a9045220ea2 100644 --- a/packages/core/src/codewhisperer/util/authUtil.ts +++ b/packages/core/src/codewhisperer/util/authUtil.ts @@ -8,7 +8,7 @@ import * as localizedText from '../../shared/localizedText' import { Auth } from '../../auth/auth' import { ToolkitError, isNetworkError, tryRun } from '../../shared/errors' import { getSecondaryAuth, setScopes } from '../../auth/secondaryAuth' -import { isCloud9, isSageMaker } from '../../shared/extensionUtilities' +import { isSageMaker } from '../../shared/extensionUtilities' import { AmazonQPromptSettings } from '../../shared/settings' import { scopesCodeWhispererCore, @@ -55,14 +55,8 @@ export const amazonQScopes = [...codeWhispererChatScopes, ...scopesGumby, ...sco * for Amazon Q. */ export const isValidCodeWhispererCoreConnection = (conn?: Connection): conn is Connection => { - if (isCloud9('classic')) { - return isIamConnection(conn) - } - return ( - (isSageMaker() && isIamConnection(conn)) || - (isCloud9('codecatalyst') && isIamConnection(conn)) || - (isSsoConnection(conn) && hasScopes(conn, codeWhispererCoreScopes)) + (isSageMaker() && isIamConnection(conn)) || (isSsoConnection(conn) && hasScopes(conn, codeWhispererCoreScopes)) ) } /** Superset that includes all of CodeWhisperer + Amazon Q */ @@ -144,10 +138,6 @@ export class AuthUtil { }) public async setVscodeContextProps() { - if (isCloud9()) { - return - } - await setContext('aws.codewhisperer.connected', this.isConnected()) const doShowAmazonQLoginView = !this.isConnected() || this.isConnectionExpired() await setContext('aws.amazonq.showLoginView', doShowAmazonQLoginView) diff --git a/packages/core/src/codewhisperer/util/closingBracketUtil.ts b/packages/core/src/codewhisperer/util/closingBracketUtil.ts index b9511349e9c..466ca31a0b9 100644 --- a/packages/core/src/codewhisperer/util/closingBracketUtil.ts +++ b/packages/core/src/codewhisperer/util/closingBracketUtil.ts @@ -4,8 +4,6 @@ */ import * as vscode from 'vscode' -import { workspace, WorkspaceEdit } from 'vscode' -import { isCloud9 } from '../../shared/extensionUtilities' import * as CodeWhispererConstants from '../models/constants' interface bracketMapType { @@ -97,31 +95,18 @@ const removeBracketsFromRightContext = async ( ) => { const offset = editor.document.offsetAt(endPosition) - if (isCloud9()) { - const edits = idxToRemove.map((idx) => ({ - range: new vscode.Range( - editor.document.positionAt(offset + idx), - editor.document.positionAt(offset + idx + 1) - ), - newText: '', - })) - const wEdit = new WorkspaceEdit() - wEdit.set(editor.document.uri, [...edits]) - await workspace.applyEdit(wEdit) - } else { - await editor.edit( - (editBuilder) => { - for (const idx of idxToRemove) { - const range = new vscode.Range( - editor.document.positionAt(offset + idx), - editor.document.positionAt(offset + idx + 1) - ) - editBuilder.delete(range) - } - }, - { undoStopAfter: false, undoStopBefore: false } - ) - } + await editor.edit( + (editBuilder) => { + for (const idx of idxToRemove) { + const range = new vscode.Range( + editor.document.positionAt(offset + idx), + editor.document.positionAt(offset + idx + 1) + ) + editBuilder.delete(range) + } + }, + { undoStopAfter: false, undoStopBefore: false } + ) } function getBracketsToRemove( diff --git a/packages/core/src/codewhisperer/util/commonUtil.ts b/packages/core/src/codewhisperer/util/commonUtil.ts index 1d624e77b5e..d2df78f1369 100644 --- a/packages/core/src/codewhisperer/util/commonUtil.ts +++ b/packages/core/src/codewhisperer/util/commonUtil.ts @@ -6,7 +6,6 @@ import * as vscode from 'vscode' import * as semver from 'semver' import { distance } from 'fastest-levenshtein' -import { isCloud9 } from '../../shared/extensionUtilities' import { getInlineSuggestEnabled } from '../../shared/utilities/editorUtilities' import { AWSTemplateCaseInsensitiveKeyWords, @@ -31,12 +30,12 @@ export function asyncCallWithTimeout(asyncPromise: Promise, message: strin } export function isInlineCompletionEnabled() { - return getInlineSuggestEnabled() && !isCloud9() + return getInlineSuggestEnabled() } // This is the VS Code version that started to have regressions in inline completion API export function isVscHavingRegressionInlineCompletionApi() { - return semver.gte(vscode.version, '1.78.0') && getInlineSuggestEnabled() && !isCloud9() + return semver.gte(vscode.version, '1.78.0') && getInlineSuggestEnabled() } export function getFileExt(languageId: string) { diff --git a/packages/core/src/codewhisperer/util/showSsoPrompt.ts b/packages/core/src/codewhisperer/util/showSsoPrompt.ts index fbe1e6cb41c..229583a8cc2 100644 --- a/packages/core/src/codewhisperer/util/showSsoPrompt.ts +++ b/packages/core/src/codewhisperer/util/showSsoPrompt.ts @@ -14,15 +14,12 @@ import { CancellationError } from '../../shared/utilities/timeoutUtils' import { ToolkitError } from '../../shared/errors' import { createCommonButtons } from '../../shared/ui/buttons' import { telemetry } from '../../shared/telemetry/telemetry' -import { isCloud9 } from '../../shared/extensionUtilities' import { createBuilderIdItem, createSsoItem, createIamItem } from '../../auth/utils' import { Commands } from '../../shared/vscode/commands2' import { vsCodeState } from '../models/model' export const showCodeWhispererConnectionPrompt = async () => { - const items = isCloud9('classic') - ? [createSsoItem(), createCodeWhispererIamItem()] - : [createBuilderIdItem(), createSsoItem(), createCodeWhispererIamItem()] + const items = [createBuilderIdItem(), createSsoItem(), createCodeWhispererIamItem()] const resp = await showQuickPick(items, { title: 'Amazon Q: Add Connection to AWS', diff --git a/packages/core/src/codewhisperer/vue/backend.ts b/packages/core/src/codewhisperer/vue/backend.ts index e4baecadc18..f92552e247a 100644 --- a/packages/core/src/codewhisperer/vue/backend.ts +++ b/packages/core/src/codewhisperer/vue/backend.ts @@ -8,7 +8,6 @@ import * as os from 'os' import * as vscode from 'vscode' import * as path from 'path' import { VueWebview } from '../../webviews/main' -import { isCloud9 } from '../../shared/extensionUtilities' import globals from '../../shared/extensionGlobals' import { telemetry, CodewhispererLanguage, CodewhispererGettingStartedTask } from '../../shared/telemetry/telemetry' import { fs } from '../../shared' @@ -148,7 +147,7 @@ export async function showCodeWhispererWebview( } const webview = await activePanel!.show({ title: localize('AWS.view.gettingStartedPage.title', `Learn Amazon Q`), - viewColumn: isCloud9() ? vscode.ViewColumn.One : vscode.ViewColumn.Active, + viewColumn: vscode.ViewColumn.Active, }) if (!subscriptions) { diff --git a/packages/core/src/commands.ts b/packages/core/src/commands.ts index 6177c953242..f1e77f24cf9 100644 --- a/packages/core/src/commands.ts +++ b/packages/core/src/commands.ts @@ -36,7 +36,7 @@ import { CommonAuthWebview } from './login/webview' import { AuthSource, AuthSources } from './login/webview/util' import { ServiceItemId, isServiceItemId } from './login/webview/vue/types' import { authHelpUrl } from './shared/constants' -import { isCloud9, getIdeProperties } from './shared/extensionUtilities' +import { getIdeProperties } from './shared/extensionUtilities' import { telemetry } from './shared/telemetry/telemetry' import { createCommonButtons } from './shared/ui/buttons' import { showQuickPick } from './shared/ui/pickerPrompter' @@ -66,12 +66,7 @@ export function registerCommands(context: vscode.ExtensionContext) { const addConnection = Commands.register( { id: 'aws.toolkit.auth.addConnection', telemetryThrottleMs: false }, async () => { - const c9IamItem = createIamItem() - c9IamItem.detail = - 'Activates working with resources in the Explorer. Requires an access key ID and secret access key.' - const items = isCloud9() - ? [createSsoItem(), c9IamItem] - : [createBuilderIdItem(), createSsoItem(), createIamItem()] + const items = [createBuilderIdItem(), createSsoItem(), createIamItem()] const resp = await showQuickPick(items, { title: localize('aws.auth.addConnection.title', 'Add a Connection to {0}', getIdeProperties().company), @@ -113,9 +108,7 @@ export function registerCommands(context: vscode.ExtensionContext) { source = AuthSources.vscodeComponent } - // The auth webview page does not make sense to use in C9, - // so show the auth quick pick instead. - if (isCloud9('any') || isWeb()) { + if (isWeb()) { // TODO: CW no longer exists in toolkit. This should be moved to Amazon Q if (source.toLowerCase().includes('codewhisperer')) { // Show CW specific quick pick for CW connections diff --git a/packages/core/src/dev/beta.ts b/packages/core/src/dev/beta.ts index b09516dcc3c..89bd085e84e 100644 --- a/packages/core/src/dev/beta.ts +++ b/packages/core/src/dev/beta.ts @@ -18,7 +18,7 @@ import { isUserCancelledError, ToolkitError } from '../shared/errors' import { telemetry } from '../shared/telemetry/telemetry' import { cast } from '../shared/utilities/typeConstructors' import { CancellationError } from '../shared/utilities/timeoutUtils' -import { isAmazonQ, isCloud9, productName } from '../shared/extensionUtilities' +import { isAmazonQ, productName } from '../shared/extensionUtilities' import * as devConfig from './config' import { isReleaseVersion } from '../shared/vscode/env' import { getRelativeDate } from '../shared/datetime' @@ -49,7 +49,7 @@ async function updateBetaToolkitData(vsixUrl: string, data: BetaToolkit) { */ export async function activate(ctx: vscode.ExtensionContext) { const betaUrl = isAmazonQ() ? devConfig.betaUrl.amazonq : devConfig.betaUrl.toolkit - if (!isCloud9() && !isReleaseVersion() && betaUrl) { + if (!isReleaseVersion() && betaUrl) { ctx.subscriptions.push(watchBetaVSIX(betaUrl)) } } diff --git a/packages/core/src/dynamicResources/awsResourceManager.ts b/packages/core/src/dynamicResources/awsResourceManager.ts index a6045559675..de990e6c6b9 100644 --- a/packages/core/src/dynamicResources/awsResourceManager.ts +++ b/packages/core/src/dynamicResources/awsResourceManager.ts @@ -17,7 +17,6 @@ import { getLogger } from '../shared/logger/logger' import { getTabSizeSetting } from '../shared/utilities/editorUtilities' import { ResourceNode } from './explorer/nodes/resourceNode' import { ResourceTypeNode } from './explorer/nodes/resourceTypeNode' -import { isCloud9 } from '../shared/extensionUtilities' import globals from '../shared/extensionGlobals' import { fs } from '../shared' @@ -72,7 +71,7 @@ export class AwsResourceManager { } const doc = await vscode.workspace.openTextDocument(uri) - if (existing && !isCloud9()) { + if (existing) { await this.close(existing) } diff --git a/packages/core/src/dynamicResources/explorer/nodes/resourcesNode.ts b/packages/core/src/dynamicResources/explorer/nodes/resourcesNode.ts index 72374d17a5b..313ce4e7d2a 100644 --- a/packages/core/src/dynamicResources/explorer/nodes/resourcesNode.ts +++ b/packages/core/src/dynamicResources/explorer/nodes/resourcesNode.ts @@ -14,7 +14,6 @@ import { ResourceTypeNode } from './resourceTypeNode' import { CloudFormation } from 'aws-sdk' import { CloudControlClient, DefaultCloudControlClient } from '../../../shared/clients/cloudControlClient' import { memoizedGetResourceTypes, ResourceTypeMetadata } from '../../model/resources' -import { isCloud9 } from '../../../shared/extensionUtilities' import { ResourcesSettings } from '../../commands/configure' const localize = nls.loadMessageBundle() @@ -57,8 +56,7 @@ export class ResourcesNode extends AWSTreeNodeBase { public async updateChildren(): Promise { const resourceTypes = memoizedGetResourceTypes() - const defaultResources = isCloud9() ? Array.from(resourceTypes.keys()) : [] - const enabledResources = this.settings.get('enabledResources', defaultResources) + const enabledResources = this.settings.get('enabledResources', []) // Use the most recently update type definition per-type const types = await toArrayAsync(this.cloudFormation.listTypes()) diff --git a/packages/core/src/extension.ts b/packages/core/src/extension.ts index 00fd730b490..897140c4249 100644 --- a/packages/core/src/extension.ts +++ b/packages/core/src/extension.ts @@ -17,7 +17,7 @@ import globals, { initialize, isWeb } from './shared/extensionGlobals' import { join } from 'path' import { Commands } from './shared/vscode/commands2' import { endpointsFileUrl, githubCreateIssueUrl, githubUrl } from './shared/constants' -import { getIdeProperties, aboutExtension, isCloud9, getDocUrl } from './shared/extensionUtilities' +import { getIdeProperties, aboutExtension, getDocUrl } from './shared/extensionUtilities' import { logAndShowError, logAndShowWebviewError } from './shared/utilities/logAndShowUtils' import { telemetry } from './shared/telemetry/telemetry' import { openUrl } from './shared/utilities/vsCodeUtils' @@ -38,7 +38,6 @@ import { RegionProvider, getEndpointsFromFetcher } from './shared/regions/region import { getMachineId, isAutomation } from './shared/vscode/env' import { registerCommandErrorHandler } from './shared/vscode/commands2' import { registerWebviewErrorHandler } from './webviews/server' -import { showQuickStartWebview } from './shared/extensionStartup' import { ExtContext, VSCODE_EXTENSION_ID } from './shared/extensions' import { getSamCliContext } from './shared/sam/cli/samCliContext' import { UriHandler } from './shared/vscode/uriHandler' @@ -99,19 +98,6 @@ export async function activateCommon( void maybeShowMinVscodeWarning('1.83.0') - if (isCloud9()) { - vscode.window.withProgress = wrapWithProgressForCloud9(globals.outputChannel) - context.subscriptions.push( - Commands.register('aws.quickStart', async () => { - try { - await showQuickStartWebview(context) - } finally { - telemetry.aws_helpQuickstart.emit({ result: 'Succeeded' }) - } - }) - ) - } - // setup globals globals.machineId = await getMachineId() globals.awsContext = new DefaultAwsContext() @@ -224,32 +210,3 @@ export function makeEndpointsProvider() { remote: () => getEndpointsFromFetcher(remoteManifestFetcher), } } - -/** - * Wraps the `vscode.window.withProgress` functionality with functionality that also writes to the output channel. - * - * Cloud9 does not show a progress notification. - */ -function wrapWithProgressForCloud9(channel: vscode.OutputChannel): (typeof vscode.window)['withProgress'] { - const withProgress = vscode.window.withProgress.bind(vscode.window) - - return (options, task) => { - if (options.title) { - channel.appendLine(options.title) - } - - return withProgress(options, (progress, token) => { - const newProgress: typeof progress = { - ...progress, - report: (value) => { - if (value.message) { - channel.appendLine(value.message) - } - progress.report(value) - }, - } - - return task(newProgress, token) - }) - } -} diff --git a/packages/core/src/extensionNode.ts b/packages/core/src/extensionNode.ts index 0c53cc89975..54d908466f0 100644 --- a/packages/core/src/extensionNode.ts +++ b/packages/core/src/extensionNode.ts @@ -17,7 +17,6 @@ import { AwsContextCommands } from './shared/awsContextCommands' import { getIdeProperties, getExtEnvironmentDetails, - isCloud9, isSageMaker, showWelcomeMessage, } from './shared/extensionUtilities' @@ -182,19 +181,17 @@ export async function activate(context: vscode.ExtensionContext) { await activateSchemas(extContext) - if (!isCloud9()) { - if (!isSageMaker()) { - // Amazon Q/CodeWhisperer Tree setup. - learnMoreAmazonQCommand.register() - qExtensionPageCommand.register() - dismissQTree.register() - installAmazonQExtension.register() + if (!isSageMaker()) { + // Amazon Q Tree setup. + learnMoreAmazonQCommand.register() + qExtensionPageCommand.register() + dismissQTree.register() + installAmazonQExtension.register() - await handleAmazonQInstall() - } - await activateApplicationComposer(context) - await activateThreatComposerEditor(context) + await handleAmazonQInstall() } + await activateApplicationComposer(context) + await activateThreatComposerEditor(context) await activateStepFunctions(context, globals.awsContext, globals.outputChannel) diff --git a/packages/core/src/lambda/activation.ts b/packages/core/src/lambda/activation.ts index 4a21b2e9611..3ea90d61e7c 100644 --- a/packages/core/src/lambda/activation.ts +++ b/packages/core/src/lambda/activation.ts @@ -72,10 +72,10 @@ export async function activate(context: ExtContext): Promise { await copyLambdaUrl(sourceNode, new DefaultLambdaClient(sourceNode.regionCode)) }), - registerSamInvokeVueCommand(context), + registerSamInvokeVueCommand(context.extensionContext), Commands.register('aws.launchDebugConfigForm', async (node: ResourceNode) => - registerSamDebugInvokeVueCommand(context, { resource: node }) + registerSamDebugInvokeVueCommand(context.extensionContext, { resource: node }) ) ) } diff --git a/packages/core/src/lambda/commands/createNewSamApp.ts b/packages/core/src/lambda/commands/createNewSamApp.ts index e60e60c31ed..8c6f5fbab19 100644 --- a/packages/core/src/lambda/commands/createNewSamApp.ts +++ b/packages/core/src/lambda/commands/createNewSamApp.ts @@ -39,12 +39,7 @@ import { isTemplateTargetProperties } from '../../shared/sam/debugger/awsSamDebu import { TemplateTargetProperties } from '../../shared/sam/debugger/awsSamDebugConfiguration' import { openLaunchJsonFile } from '../../shared/sam/debugger/commands/addSamDebugConfiguration' import { waitUntil } from '../../shared/utilities/timeoutUtils' -import { - getIdeProperties, - getDebugNewSamAppDocUrl, - isCloud9, - getLaunchConfigDocUrl, -} from '../../shared/extensionUtilities' +import { getIdeProperties, getDebugNewSamAppDocUrl, getLaunchConfigDocUrl } from '../../shared/extensionUtilities' import { checklogs } from '../../shared/localizedText' import globals from '../../shared/extensionGlobals' import { telemetry } from '../../shared/telemetry/telemetry' @@ -473,9 +468,7 @@ export async function writeToolkitReadme( .replace(/\$\{LISTOFCONFIGURATIONS\}/g, configString) .replace( /\$\{DOCURL\}/g, - isCloud9() - ? 'https://docs.aws.amazon.com/cloud9/latest/user-guide/serverless-apps-toolkit.html' - : 'https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/serverless-apps.html' + 'https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/serverless-apps.html' ) await fs.writeFile(readmeLocation, readme) diff --git a/packages/core/src/lambda/commands/uploadLambda.ts b/packages/core/src/lambda/commands/uploadLambda.ts index 7627d53cfab..e5a4ce34755 100644 --- a/packages/core/src/lambda/commands/uploadLambda.ts +++ b/packages/core/src/lambda/commands/uploadLambda.ts @@ -20,7 +20,7 @@ import { getSamCliContext } from '../../shared/sam/cli/samCliContext' import { SamTemplateGenerator } from '../../shared/templates/sam/samTemplateGenerator' import { addCodiconToString } from '../../shared/utilities/textUtilities' import { getLambdaDetails, listLambdaFunctions } from '../utils' -import { getIdeProperties, isCloud9 } from '../../shared/extensionUtilities' +import { getIdeProperties } from '../../shared/extensionUtilities' import { createQuickPick, DataQuickPickItem } from '../../shared/ui/pickerPrompter' import { createCommonButtons } from '../../shared/ui/buttons' import { StepEstimator, Wizard, WIZARD_BACK } from '../../shared/wizards/wizard' @@ -481,10 +481,7 @@ async function uploadZipBuffer( ) } -export async function findApplicationJsonFile( - startPath: vscode.Uri, - cloud9 = isCloud9() -): Promise { +export async function findApplicationJsonFile(startPath: vscode.Uri): Promise { if (!(await fs.exists(startPath.fsPath))) { getLogger().error( 'findApplicationJsonFile() invalid path (not accessible or does not exist): "%s"', diff --git a/packages/core/src/lambda/local/debugConfiguration.ts b/packages/core/src/lambda/local/debugConfiguration.ts index 999b36ddce2..b21599b0563 100644 --- a/packages/core/src/lambda/local/debugConfiguration.ts +++ b/packages/core/src/lambda/local/debugConfiguration.ts @@ -54,20 +54,6 @@ export interface PythonDebugConfiguration extends SamLaunchRequestArgs { readonly pathMappings: PythonPathMapping[] } -/** Alternative (Cloud9) Python debugger: ikp3db */ -export interface PythonCloud9DebugConfiguration extends SamLaunchRequestArgs { - readonly runtimeFamily: RuntimeFamily.Python - /** Passed to "sam build --manifest …" */ - readonly manifestPath: string | undefined - - // Fields expected by the Cloud9 debug adapter. - // (Cloud9 sourcefile: debugger-vscode-mainthread-adapter.ts) - readonly port: number - readonly address: string - readonly localRoot: string - readonly remoteRoot: string -} - export interface DotNetDebugConfiguration extends SamLaunchRequestArgs { readonly runtimeFamily: RuntimeFamily.DotNet processName: string diff --git a/packages/core/src/lambda/models/samTemplates.ts b/packages/core/src/lambda/models/samTemplates.ts index 963cbdaafa5..5ec112a7dc4 100644 --- a/packages/core/src/lambda/models/samTemplates.ts +++ b/packages/core/src/lambda/models/samTemplates.ts @@ -12,10 +12,26 @@ import { supportsEventBridgeTemplates } from '../../../src/eventSchemas/models/s import { RuntimePackageType } from './samLambdaRuntime' import { getIdeProperties } from '../../shared/extensionUtilities' -export let helloWorldTemplate = 'helloWorldUninitialized' -export let eventBridgeHelloWorldTemplate = 'eventBridgeHelloWorldUninitialized' -export let eventBridgeStarterAppTemplate = 'eventBridgeStarterAppUnintialized' -export let stepFunctionsSampleApp = 'stepFunctionsSampleAppUnintialized' +export const helloWorldTemplate = localize( + 'AWS.samcli.initWizard.template.helloWorld.name', + '{0} SAM Hello World', + getIdeProperties().company +) +export const eventBridgeHelloWorldTemplate = localize( + 'AWS.samcli.initWizard.template.helloWorld.name', + '{0} SAM EventBridge Hello World', + getIdeProperties().company +) +export const eventBridgeStarterAppTemplate = localize( + 'AWS.samcli.initWizard.template.helloWorld.name', + '{0} SAM EventBridge App from Scratch', + getIdeProperties().company +) +export const stepFunctionsSampleApp = localize( + 'AWS.samcli.initWizard.template.helloWorld.name', + '{0} Step Functions Sample App', + getIdeProperties().company +) export const typeScriptBackendTemplate = 'App Backend using TypeScript' export const repromptUserForTemplate = 'REQUIRES_AWS_CREDENTIALS_REPROMPT_USER_FOR_TEMPLATE' @@ -23,33 +39,6 @@ export const cliVersionStepFunctionsTemplate = '0.52.0' export type SamTemplate = string -/** - * Lazy load strings for SAM template quick picks - * Need to be lazyloaded as `getIdeProperties` requires IDE activation for Cloud9 - */ -export function lazyLoadSamTemplateStrings(): void { - helloWorldTemplate = localize( - 'AWS.samcli.initWizard.template.helloWorld.name', - '{0} SAM Hello World', - getIdeProperties().company - ) - eventBridgeHelloWorldTemplate = localize( - 'AWS.samcli.initWizard.template.helloWorld.name', - '{0} SAM EventBridge Hello World', - getIdeProperties().company - ) - eventBridgeStarterAppTemplate = localize( - 'AWS.samcli.initWizard.template.helloWorld.name', - '{0} SAM EventBridge App from Scratch', - getIdeProperties().company - ) - stepFunctionsSampleApp = localize( - 'AWS.samcli.initWizard.template.helloWorld.name', - '{0} Step Functions Sample App', - getIdeProperties().company - ) -} - export function getSamTemplateWizardOption( runtime: Runtime, packageType: RuntimePackageType, diff --git a/packages/core/src/lambda/vue/configEditor/samInvokeBackend.ts b/packages/core/src/lambda/vue/configEditor/samInvokeBackend.ts index d2f2ec912da..ba624536b0f 100644 --- a/packages/core/src/lambda/vue/configEditor/samInvokeBackend.ts +++ b/packages/core/src/lambda/vue/configEditor/samInvokeBackend.ts @@ -7,8 +7,6 @@ import * as path from 'path' import * as vscode from 'vscode' import * as nls from 'vscode-nls' import { LaunchConfiguration } from '../../../shared/debug/launchConfiguration' - -import { ExtContext } from '../../../shared/extensions' import { getLogger } from '../../../shared/logger' import { HttpResourceFetcher } from '../../../shared/resourcefetcher/httpResourceFetcher' import { @@ -28,8 +26,6 @@ import { tryGetAbsolutePath } from '../../../shared/utilities/workspaceUtils' import * as CloudFormation from '../../../shared/cloudformation/cloudformation' import { openLaunchJsonFile } from '../../../shared/sam/debugger/commands/addSamDebugConfiguration' import { getSampleLambdaPayloads } from '../../utils' -import { isCloud9 } from '../../../shared/extensionUtilities' -import { SamDebugConfigProvider } from '../../../shared/sam/debugger/awsSamDebugger' import { samLambdaCreatableRuntimes } from '../../models/samLambdaRuntime' import globals from '../../../shared/extensionGlobals' import { VueWebview } from '../../../webviews/main' @@ -78,7 +74,6 @@ export class SamInvokeWebview extends VueWebview { public readonly id = 'createLambda' public constructor( - private readonly extContext: ExtContext, // TODO(sijaden): get rid of `ExtContext` private readonly config?: AwsSamDebuggerConfiguration, private readonly data?: ResourceData ) { @@ -358,17 +353,8 @@ export class SamInvokeWebview extends VueWebview { const targetUri = await this.getUriFromLaunchConfig(finalConfig) const folder = targetUri ? vscode.workspace.getWorkspaceFolder(targetUri) : undefined - // Cloud9 currently can't resolve the `aws-sam` debug config provider. - // Directly invoke the config instead. - // NOTE: This bypasses the `${workspaceFolder}` resolution, but shouldn't naturally occur in Cloud9 - // (Cloud9 also doesn't currently have variable resolution support anyways) - if (isCloud9()) { - const provider = new SamDebugConfigProvider(this.extContext) - await provider.resolveDebugConfiguration(folder, finalConfig, undefined, source) - } else { - // startDebugging on VS Code goes through the whole resolution chain - await vscode.debug.startDebugging(folder, finalConfig) - } + // startDebugging on VS Code goes through the whole resolution chain + await vscode.debug.startDebugging(folder, finalConfig) } public async getLaunchConfigQuickPickItems( launchConfig: LaunchConfiguration, @@ -427,9 +413,9 @@ export class SamInvokeWebview extends VueWebview { const WebviewPanel = VueWebview.compilePanel(SamInvokeWebview) -export function registerSamInvokeVueCommand(context: ExtContext): vscode.Disposable { +export function registerSamInvokeVueCommand(context: vscode.ExtensionContext): vscode.Disposable { return Commands.register('aws.launchConfigForm', async (launchConfig?: AwsSamDebuggerConfiguration) => { - const webview = new WebviewPanel(context.extensionContext, context, launchConfig) + const webview = new WebviewPanel(context, launchConfig) await telemetry.sam_openConfigUi.run(async (span) => { await webview.show({ title: localize('AWS.command.launchConfigForm.title', 'Local Invoke and Debug Configuration'), @@ -440,11 +426,14 @@ export function registerSamInvokeVueCommand(context: ExtContext): vscode.Disposa }) } -export async function registerSamDebugInvokeVueCommand(context: ExtContext, params: { resource: ResourceNode }) { +export async function registerSamDebugInvokeVueCommand( + context: vscode.ExtensionContext, + params: { resource: ResourceNode } +) { const launchConfig: AwsSamDebuggerConfiguration | undefined = undefined const resource = params?.resource.resource const source = 'AppBuilderLocalInvoke' - const webview = new WebviewPanel(context.extensionContext, context, launchConfig, { + const webview = new WebviewPanel(context, launchConfig, { logicalId: resource.resource.Id ?? '', region: resource.region ?? '', location: resource.location.fsPath, diff --git a/packages/core/src/login/webview/commonAuthViewProvider.ts b/packages/core/src/login/webview/commonAuthViewProvider.ts index d5f94748e07..8f641acdb8d 100644 --- a/packages/core/src/login/webview/commonAuthViewProvider.ts +++ b/packages/core/src/login/webview/commonAuthViewProvider.ts @@ -11,7 +11,7 @@ "type": "webview", "id": "aws.AmazonCommonAuth", "name": "%AWS.amazonq.login%", -"when": "!isCloud9 && !aws.isSageMaker && !aws.amazonq.showView" +"when": "!aws.isSageMaker && !aws.amazonq.showView" }, * 2. Assign when clause context to this view. Manage the state of when clause context. diff --git a/packages/core/src/shared/cloudformation/cloudformation.ts b/packages/core/src/shared/cloudformation/cloudformation.ts index f845a73ebc4..a22ff6d75b2 100644 --- a/packages/core/src/shared/cloudformation/cloudformation.ts +++ b/packages/core/src/shared/cloudformation/cloudformation.ts @@ -11,7 +11,6 @@ import * as filesystemUtilities from '../filesystemUtilities' import fs from '../../shared/fs/fs' import { getLogger } from '../logger' import { lambdaPackageTypeImage } from '../constants' -import { isCloud9 } from '../extensionUtilities' import { isUntitledScheme, normalizeVSCodeUri } from '../utilities/vsCodeUtils' export const SERVERLESS_API_TYPE = 'AWS::Serverless::Api' // eslint-disable-line @typescript-eslint/naming-convention @@ -893,20 +892,18 @@ export async function createStarterTemplateFile(isSam?: boolean): Promise /** * Creates a boilerplate CFN or SAM template that is complete enough to be picked up for JSON schema assignment - * TODO: Remove `isCloud9` when Cloud9 gets YAML code completion * @param isSam Create a SAM or CFN template */ function createStarterTemplateYaml(isSam?: boolean): string { return `AWSTemplateFormatVersion: '2010-09-09' ${isSam ? 'Transform: AWS::Serverless-2016-10-31\n' : ''} Description: -${isCloud9() ? '' : '\n# Available top-level fields are listed in code completion\n'} +# Available top-level fields are listed in code completion # Add Resources Here: uncomment the following lines # Resources: # : -# Type: # resource type here${isCloud9() ? '' : ' - available resources are listed in code completion'} -# # # Properties: ` diff --git a/packages/core/src/shared/datetime.ts b/packages/core/src/shared/datetime.ts index bc7f562f83f..6123421666a 100644 --- a/packages/core/src/shared/datetime.ts +++ b/packages/core/src/shared/datetime.ts @@ -3,8 +3,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { isCloud9 } from './extensionUtilities' - // constants for working with milliseconds export const oneSecond = 1000 export const oneMinute = oneSecond * 60 @@ -119,7 +117,7 @@ export function getRelativeDate(from: Date, now: Date = new Date()): string { * US: Jan 5, 2020 5:30:20 PM GMT-0700 * GB: 5 Jan 2020 17:30:20 GMT+0100 */ -export function formatLocalized(d: Date = new Date(), cloud9 = isCloud9()): string { +export function formatLocalized(d: Date = new Date()): string { const dateFormat = new Intl.DateTimeFormat('en-US', { year: 'numeric', month: 'short', @@ -129,7 +127,7 @@ export function formatLocalized(d: Date = new Date(), cloud9 = isCloud9()): stri hour: 'numeric', minute: 'numeric', second: 'numeric', - timeZoneName: cloud9 ? 'short' : 'shortOffset', + timeZoneName: 'shortOffset', }) return `${dateFormat.format(d)} ${timeFormat.format(d)}` diff --git a/packages/core/src/shared/extensionStartup.ts b/packages/core/src/shared/extensionStartup.ts index fd5aab755e7..740534e2177 100644 --- a/packages/core/src/shared/extensionStartup.ts +++ b/packages/core/src/shared/extensionStartup.ts @@ -4,21 +4,14 @@ */ import * as _ from 'lodash' -import * as path from 'path' import * as vscode from 'vscode' import * as semver from 'semver' -import * as nls from 'vscode-nls' - -import { BaseTemplates } from './templates/baseTemplates' -import { fs } from '../shared/fs/fs' -import { getIdeProperties, getIdeType, isAmazonQ, isCloud9, isCn, productName } from './extensionUtilities' +import { getIdeType, isAmazonQ, productName } from './extensionUtilities' import * as localizedText from './localizedText' import { AmazonQPromptSettings, ToolkitPromptSettings } from './settings' import { showMessage } from './utilities/messages' import { getTelemetryReasonDesc } from './errors' -const localize = nls.loadMessageBundle() - /** * Shows a (suppressible) warning if the current vscode version is older than `minVscode`. */ @@ -48,75 +41,3 @@ export async function maybeShowMinVscodeWarning(minVscode: string) { }) } } - -/** - * Helper function to show a webview containing the quick start page - * - * @param context VS Code Extension Context - */ -export async function showQuickStartWebview(context: vscode.ExtensionContext): Promise { - try { - const view = await createQuickStartWebview(context) - view.reveal() - } catch { - void vscode.window.showErrorMessage( - localize('AWS.command.quickStart.error', 'Error while loading Quick Start page') - ) - } -} - -/** - * Helper function to create a webview containing the quick start page - * Returns an unfocused vscode.WebviewPanel if the quick start page is renderable. - * - * @param context VS Code Extension Context - * @param page Page to load (use for testing) - */ -export async function createQuickStartWebview( - context: vscode.ExtensionContext, - page?: string -): Promise { - let actualPage: string - if (page) { - actualPage = page - } else if (isCloud9()) { - actualPage = `quickStartCloud9${isCn() ? '-cn' : ''}.html` - } else { - actualPage = 'quickStartVscode.html' - } - // create hidden webview, leave it up to the caller to show - const view = vscode.window.createWebviewPanel( - 'html', - localize('AWS.command.quickStart.title', '{0} Toolkit - Quick Start', getIdeProperties().company), - { viewColumn: vscode.ViewColumn.Active, preserveFocus: true }, - { enableScripts: true } - ) - - const baseTemplateFn = _.template(BaseTemplates.simpleHtml) - - const htmlBody = convertExtensionRootTokensToPath( - await fs.readFileText(path.join(context.extensionPath, actualPage)), - context.extensionPath, - view.webview - ) - - view.webview.html = baseTemplateFn({ - cspSource: view.webview.cspSource, - content: htmlBody, - }) - - return view -} - -/** - * Utility function to search for tokens in a string and convert them to relative paths parseable by VS Code - * Useful for converting HTML images to webview-usable images - * - * @param text Text to scan - * @param basePath Extension path (from extension context) - */ -function convertExtensionRootTokensToPath(text: string, basePath: string, webview: vscode.Webview): string { - return text.replace(/!!EXTENSIONROOT!!(?[-a-zA-Z0-9@:%_\+.~#?&//=]*)/g, (matchedString, restOfUrl) => { - return webview.asWebviewUri(vscode.Uri.file(`${basePath}${restOfUrl}`)).toString() - }) -} diff --git a/packages/core/src/shared/extensionUtilities.ts b/packages/core/src/shared/extensionUtilities.ts index 4d758182205..01d064f88b8 100644 --- a/packages/core/src/shared/extensionUtilities.ts +++ b/packages/core/src/shared/extensionUtilities.ts @@ -12,7 +12,6 @@ import { VSCODE_EXTENSION_ID, extensionAlphaVersion } from './extensions' import { Ec2MetadataClient } from './clients/ec2MetadataClient' import { DefaultEc2MetadataClient } from './clients/ec2MetadataClient' import { extensionVersion, getCodeCatalystDevEnvId } from './vscode/env' -import { DevSettings } from './settings' import globals from './extensionGlobals' import { once } from './utilities/functionUtils' import { @@ -61,12 +60,7 @@ export function commandsPrefix(): string { let computeRegion: string | undefined = notInitialized export function getIdeType(): 'vscode' | 'cloud9' | 'sagemaker' | 'unknown' { - const settings = DevSettings.instance - if ( - vscode.env.appName === cloud9Appname || - vscode.env.appName === cloud9CnAppname || - settings.get('forceCloud9', false) - ) { + if (vscode.env.appName === cloud9Appname || vscode.env.appName === cloud9CnAppname) { return 'cloud9' } diff --git a/packages/core/src/shared/filesystemUtilities.ts b/packages/core/src/shared/filesystemUtilities.ts index 1c8cf40f11a..d462d85ac15 100644 --- a/packages/core/src/shared/filesystemUtilities.ts +++ b/packages/core/src/shared/filesystemUtilities.ts @@ -39,7 +39,6 @@ export async function getDirSize(dirPath: string, startTime: number, duration: n return getDirSize(filePath, startTime, duration) } if (type === vscode.FileType.File) { - // TODO: This is SLOW on Cloud9. const stat = await fs.stat(filePath) return stat.size } diff --git a/packages/core/src/shared/fs/fs.ts b/packages/core/src/shared/fs/fs.ts index 477b16c12ea..1c7132648bc 100644 --- a/packages/core/src/shared/fs/fs.ts +++ b/packages/core/src/shared/fs/fs.ts @@ -6,7 +6,6 @@ import vscode from 'vscode' import os from 'os' import { promises as nodefs, constants as nodeConstants, WriteFileOptions } from 'fs' // eslint-disable-line no-restricted-imports import { chmod } from 'fs/promises' -import { isCloud9 } from '../extensionUtilities' import _path from 'path' import { PermissionsError, @@ -93,15 +92,6 @@ export class FileSystem { const uri = toUri(path) const errHandler = createPermissionsErrorHandler(this.isWeb, vscode.Uri.joinPath(uri, '..'), '*wx') - // Certain URIs are not supported with vscode.workspace.fs in Cloud9 - // so revert to using `fs` which works. - if (isCloud9()) { - return nodefs - .mkdir(uri.fsPath, { recursive: true }) - .then(() => {}) - .catch(errHandler) - } - return vfs.createDirectory(uri).then(undefined, errHandler) } @@ -114,12 +104,9 @@ export class FileSystem { const uri = toUri(path) const errHandler = createPermissionsErrorHandler(this.isWeb, uri, 'r**') - if (isCloud9()) { - return await nodefs.readFile(uri.fsPath).catch(errHandler) - } - return vfs.readFile(uri).then(undefined, errHandler) } + /** * Read file and convert the resulting bytes to a string. * @param path uri or path to file. @@ -170,22 +157,6 @@ export class FileSystem { // Note: comparison is bitwise (&) because `FileType` enum is bitwise. const anyKind = fileType === undefined || fileType & vscode.FileType.Unknown - if (isCloud9()) { - // vscode.workspace.fs.stat() is SLOW. Avoid it on Cloud9. - try { - const stat = await nodefs.stat(uri.fsPath) - if (anyKind) { - return true - } else if (fileType & vscode.FileType.Directory) { - return stat.isDirectory() - } else if (fileType & vscode.FileType.File) { - return stat.isFile() - } - } catch { - return false - } - } - const r = await this.stat(uri).then( (r) => r, (err) => !isFileNotFoundError(err) @@ -240,16 +211,7 @@ export class FileSystem { // Node writeFile is the only way to set `writeOpts`, such as the `mode`, on a file . // When not in web we will use Node's writeFile() for all other scenarios. // It also has better error messages than VS Code's writeFile(). - let write = (u: Uri) => nodefs.writeFile(u.fsPath, content, opts).then(undefined, errHandler) - - if (isCloud9()) { - // In Cloud9 vscode.workspace.writeFile has limited functionality, e.g. cannot write outside - // of open workspace. - // - // This is future proofing in the scenario we switch the initial implementation of `write()` - // to something else, C9 will still use node fs. - write = (u: Uri) => nodefs.writeFile(u.fsPath, content, opts).then(undefined, errHandler) - } + const write = (u: Uri) => nodefs.writeFile(u.fsPath, content, opts).then(undefined, errHandler) // Node writeFile does NOT create parent folders by default, unlike VS Code FS writeFile() await fs.mkdir(_path.dirname(uri.fsPath)) @@ -317,10 +279,6 @@ export class FileSystem { const newUri = toUri(newPath) const errHandler = createPermissionsErrorHandler(this.isWeb, oldUri, 'rw*') - if (isCloud9()) { - return nodefs.rename(oldUri.fsPath, newUri.fsPath).catch(errHandler) - } - /** * We were seeing 'FileNotFound' errors during renames, even though we did a `writeFile()` right before the rename. * The error looks to be from here: https://github.com/microsoft/vscode/blob/09d5f4efc5089ce2fc5c8f6aeb51d728d7f4e758/src/vs/platform/files/node/diskFileSystemProvider.ts#L747 @@ -411,12 +369,6 @@ export class FileSystem { const parent = vscode.Uri.joinPath(uri, '..') const errHandler = createPermissionsErrorHandler(this.isWeb, parent, '*wx') - if (isCloud9()) { - // Cloud9 does not support vscode.workspace.fs.delete. - opt.force = !!opt.recursive - return nodefs.rm(uri.fsPath, opt).catch(errHandler) - } - if (opt.recursive) { // Error messages may be misleading if using the `recursive` option. // Need to implement our own recursive delete if we want detailed info. @@ -464,18 +416,9 @@ export class FileSystem { } async readdir(uri: vscode.Uri | string): Promise<[string, vscode.FileType][]> { - const path = toUri(uri) - - // readdir is not a supported vscode API in Cloud9 - if (isCloud9()) { - return (await nodefs.readdir(path.fsPath, { withFileTypes: true })).map((e) => [ - e.name, - e.isDirectory() ? vscode.FileType.Directory : vscode.FileType.File, - ]) - } - - return await vfs.readDirectory(path) + return await vfs.readDirectory(toUri(uri)) } + /** * Copy target file or directory * @param source diff --git a/packages/core/src/shared/icons.ts b/packages/core/src/shared/icons.ts index e4379bccf9a..76d81339fb0 100644 --- a/packages/core/src/shared/icons.ts +++ b/packages/core/src/shared/icons.ts @@ -9,7 +9,6 @@ import type * as packageJson from '../../package.json' import * as fs from 'fs' // eslint-disable-line no-restricted-imports import * as path from 'path' import { Uri, ThemeIcon, ThemeColor } from 'vscode' -import { isCloud9 } from './extensionUtilities' import { memoize } from './utilities/functionUtils' import { getLogger } from './logger/logger' @@ -45,7 +44,7 @@ export const getIcon = memoize(resolveIconId) * ``` */ export function codicon(parts: TemplateStringsArray, ...components: (string | IconPath)[]): string { - const canUse = (sub: string | IconPath) => typeof sub === 'string' || (!isCloud9() && sub instanceof Icon) + const canUse = (sub: string | IconPath) => typeof sub === 'string' || sub instanceof Icon const resolved = components.map((i) => (canUse(i) ? i : '')).map(String) return parts @@ -80,7 +79,7 @@ export class Icon extends ThemeIcon { * {@link https://code.visualstudio.com/api/references/contribution-points#contributes.colors here} */ export function addColor(icon: IconPath, color: string | ThemeColor): IconPath { - if (isCloud9() || !(icon instanceof Icon)) { + if (!(icon instanceof Icon)) { return icon } @@ -89,32 +88,20 @@ export function addColor(icon: IconPath, color: string | ThemeColor): IconPath { function resolveIconId( id: IconId, - shouldUseCloud9 = isCloud9(), iconsPath = globals.context.asAbsolutePath(path.join('resources', 'icons')) ): IconPath { const [namespace, ...rest] = id.split('-') const name = rest.join('-') - // This 'override' logic is to support legacy use-cases, though ideally we wouldn't need it at all - const cloud9Override = shouldUseCloud9 ? resolvePathsSync(path.join(iconsPath, 'cloud9'), id) : undefined - const override = cloud9Override ?? resolvePathsSync(path.join(iconsPath, namespace), name) + const override = resolvePathsSync(path.join(iconsPath, namespace), name) if (override) { getLogger().verbose(`icons: using override for "${id}"`) return override } - // TODO: remove when they support codicons + the contribution point - if (shouldUseCloud9) { - const generated = resolvePathsSync(path.join(iconsPath, 'cloud9', 'generated'), id) - - if (generated) { - return generated - } - } - // TODO: potentially embed the icon source in `package.json` to avoid this messy mapping // of course, doing that implies we must always bundle both the original icon files and the font file - const source = !['cloud9', 'vscode'].includes(namespace) + const source = !['vscode'].includes(namespace) ? Uri.joinPath(Uri.file(iconsPath), namespace, rest[0], `${rest.slice(1).join('-')}.svg`) : undefined diff --git a/packages/core/src/shared/regions/regionProvider.ts b/packages/core/src/shared/regions/regionProvider.ts index c9c010a250a..88afc96b56e 100644 --- a/packages/core/src/shared/regions/regionProvider.ts +++ b/packages/core/src/shared/regions/regionProvider.ts @@ -12,7 +12,7 @@ import * as vscode from 'vscode' import { getLogger } from '../logger' import { Endpoints, loadEndpoints, Region } from './endpoints' import { AwsContext } from '../awsContext' -import { getIdeProperties, isAmazonQ, isCloud9 } from '../extensionUtilities' +import { getIdeProperties, isAmazonQ } from '../extensionUtilities' import { ResourceFetcher } from '../resourcefetcher/resourcefetcher' import { isSsoConnection } from '../../auth/connection' import { Auth } from '../../auth/auth' @@ -185,17 +185,10 @@ export class RegionProvider { 'AWS.error.endpoint.load.failure', 'The {0} Toolkit was unable to load endpoints data.', getIdeProperties().company - )} ${ - isCloud9() - ? localize( - 'AWS.error.impactedFunctionalityReset.cloud9', - 'Toolkit functionality may be impacted until the Cloud9 browser tab is refreshed.' - ) - : localize( - 'AWS.error.impactedFunctionalityReset.vscode', - 'Toolkit functionality may be impacted until VS Code is restarted.' - ) - }` + )} ${localize( + 'AWS.error.impactedFunctionalityReset.vscode', + 'Toolkit functionality may be impacted until VS Code is restarted.' + )}` ) }) diff --git a/packages/core/src/shared/sam/activation.ts b/packages/core/src/shared/sam/activation.ts index 3f398968b19..855dde39a29 100644 --- a/packages/core/src/shared/sam/activation.ts +++ b/packages/core/src/shared/sam/activation.ts @@ -19,7 +19,7 @@ import * as goLensProvider from '../codelens/goCodeLensProvider' import { SamTemplateCodeLensProvider } from '../codelens/samTemplateCodeLensProvider' import * as jsLensProvider from '../codelens/typescriptCodeLensProvider' import { ExtContext, VSCODE_EXTENSION_ID } from '../extensions' -import { getIdeProperties, getIdeType, isCloud9 } from '../extensionUtilities' +import { getIdeProperties, getIdeType } from '../extensionUtilities' import { getLogger } from '../logger/logger' import { PerfLog } from '../logger/perfLogger' import { NoopWatcher } from '../fs/watchedFiles' @@ -28,7 +28,6 @@ import { CodelensRootRegistry } from '../fs/codelensRootRegistry' import { AWS_SAM_DEBUG_TYPE } from './debugger/awsSamDebugConfiguration' import { SamDebugConfigProvider } from './debugger/awsSamDebugger' import { addSamDebugConfiguration } from './debugger/commands/addSamDebugConfiguration' -import { lazyLoadSamTemplateStrings } from '../../lambda/models/samTemplates' import { ToolkitPromptSettings } from '../settings' import { shared } from '../utilities/functionUtils' import { SamCliSettings } from './cli/samCliSettings' @@ -125,7 +124,6 @@ export async function activate(ctx: ExtContext): Promise { } async function registerCommands(ctx: ExtContext, settings: SamCliSettings): Promise { - lazyLoadSamTemplateStrings() ctx.extensionContext.subscriptions.push( Commands.register({ id: 'aws.samcli.detect', autoconnect: false }, () => sharedDetectSamCli({ passive: false, showMessage: true }) @@ -273,13 +271,10 @@ async function activateCodefileOverlays( supportedLanguages[jsLensProvider.javascriptLanguage] = tsCodeLensProvider supportedLanguages[pyLensProvider.pythonLanguage] = pyCodeLensProvider - - if (!isCloud9()) { - supportedLanguages[javaLensProvider.javaLanguage] = javaCodeLensProvider - supportedLanguages[csLensProvider.csharpLanguage] = csCodeLensProvider - supportedLanguages[goLensProvider.goLanguage] = goCodeLensProvider - supportedLanguages[jsLensProvider.typescriptLanguage] = tsCodeLensProvider - } + supportedLanguages[javaLensProvider.javaLanguage] = javaCodeLensProvider + supportedLanguages[csLensProvider.csharpLanguage] = csCodeLensProvider + supportedLanguages[goLensProvider.goLanguage] = goCodeLensProvider + supportedLanguages[jsLensProvider.typescriptLanguage] = tsCodeLensProvider disposables.push(vscode.languages.registerCodeLensProvider(jsLensProvider.typescriptAllFiles, tsCodeLensProvider)) disposables.push(vscode.languages.registerCodeLensProvider(pyLensProvider.pythonAllfiles, pyCodeLensProvider)) diff --git a/packages/core/src/shared/sam/cli/samCliLocalInvoke.ts b/packages/core/src/shared/sam/cli/samCliLocalInvoke.ts index 9573ffac7e6..7905e80321e 100644 --- a/packages/core/src/shared/sam/cli/samCliLocalInvoke.ts +++ b/packages/core/src/shared/sam/cli/samCliLocalInvoke.ts @@ -20,7 +20,6 @@ const localize = nls.loadMessageBundle() export const waitForDebuggerMessages = { PYTHON: 'Debugger waiting for client...', - PYTHON_IKPDB: 'IKP3db listening on', NODEJS: 'Debugger listening on', DOTNET: 'Waiting for the debugger to attach...', GO_DELVE: 'launching process with args', // Comes from https://github.com/go-delve/delve/blob/f5d2e132bca763d222680815ace98601c2396517/service/debugger/debugger.go#L187 diff --git a/packages/core/src/shared/sam/debugger/awsSamDebugConfiguration.ts b/packages/core/src/shared/sam/debugger/awsSamDebugConfiguration.ts index c249295fd84..4bf40211fa5 100644 --- a/packages/core/src/shared/sam/debugger/awsSamDebugConfiguration.ts +++ b/packages/core/src/shared/sam/debugger/awsSamDebugConfiguration.ts @@ -14,7 +14,6 @@ import { TemplateTargetProperties, } from './awsSamDebugConfiguration.gen' import { getLogger } from '../../logger' -import { isCloud9 } from '../../extensionUtilities' export * from './awsSamDebugConfiguration.gen' @@ -245,11 +244,7 @@ export function createApiAwsSamDebugConfig( function makeWorkspaceRelativePath(folder: vscode.WorkspaceFolder | undefined, target: string): string { if (vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders.length <= 1) { - return folder - ? isCloud9() // TODO: remove when Cloud9 supports ${workspaceFolder}. - ? getNormalizedRelativePath(folder.uri.fsPath, target) - : `\${workspaceFolder}/${getNormalizedRelativePath(folder.uri.fsPath, target)}` - : target + return folder ? `\${workspaceFolder}/${getNormalizedRelativePath(folder.uri.fsPath, target)}` : target } return target diff --git a/packages/core/src/shared/sam/debugger/awsSamDebugger.ts b/packages/core/src/shared/sam/debugger/awsSamDebugger.ts index 7e3eca9d53c..f0c277285ac 100644 --- a/packages/core/src/shared/sam/debugger/awsSamDebugger.ts +++ b/packages/core/src/shared/sam/debugger/awsSamDebugger.ts @@ -56,7 +56,7 @@ import { Credentials } from '@aws-sdk/types' import * as CloudFormation from '../../cloudformation/cloudformation' import { getSamCliContext, getSamCliVersion } from '../cli/samCliContext' import { minSamCliVersionForImageSupport, minSamCliVersionForGoSupport } from '../cli/samCliValidator' -import { getIdeProperties, isCloud9 } from '../../extensionUtilities' +import { getIdeProperties } from '../../extensionUtilities' import { resolve } from 'path' import globals from '../../extensionGlobals' import { Runtime, telemetry } from '../../telemetry/telemetry' @@ -205,11 +205,6 @@ export interface SamLaunchRequestArgs extends AwsSamDebuggerConfiguration { */ parameterOverrides?: string[] - /** - * HACK: Forces use of `ikp3db` python debugger in Cloud9 (and in tests). - */ - useIkpdb?: boolean - // // Invocation properties (for "execute" phase, after "config" phase). // Non-serializable... @@ -327,11 +322,6 @@ export class SamDebugConfigProvider implements vscode.DebugConfigurationProvider token?: vscode.CancellationToken, source?: string ): Promise { - if (isCloud9()) { - // TODO: remove when Cloud9 supports ${workspaceFolder}. - await this.makeAndInvokeConfig(folder, config, token, source) - return undefined - } return config } @@ -562,19 +552,15 @@ export class SamDebugConfigProvider implements vscode.DebugConfigurationProvider } else { const credentialsId = config.aws.credentials const getHelp = localize('AWS.generic.message.getHelp', 'Get Help...') - // TODO: getHelp page for Cloud9. - const extraButtons = isCloud9() - ? [] - : [ - { - label: getHelp, - onClick: () => openUrl(vscode.Uri.parse(credentialHelpUrl)), - }, - ] throw new SamLaunchRequestError(`Invalid credentials found in launch configuration: ${credentialsId}`, { code: 'InvalidCredentials', - extraButtons, + extraButtons: [ + { + label: getHelp, + onClick: () => openUrl(vscode.Uri.parse(credentialHelpUrl)), + }, + ], }) } } @@ -625,7 +611,6 @@ export class SamDebugConfigProvider implements vscode.DebugConfigurationProvider region: region, awsCredentials: awsCredentials, parameterOverrides: parameterOverrideArr, - useIkpdb: isCloud9() || !!(config as any).useIkpdb, architecture: architecture, } diff --git a/packages/core/src/shared/sam/debugger/pythonSamDebug.ts b/packages/core/src/shared/sam/debugger/pythonSamDebug.ts index 45013eaaf96..b802876c1cf 100644 --- a/packages/core/src/shared/sam/debugger/pythonSamDebug.ts +++ b/packages/core/src/shared/sam/debugger/pythonSamDebug.ts @@ -8,7 +8,6 @@ import * as os from 'os' import * as path from 'path' import { isImageLambdaConfig, - PythonCloud9DebugConfiguration, PythonDebugConfiguration, PythonPathMapping, } from '../../../lambda/local/debugConfiguration' @@ -19,9 +18,6 @@ import { fileExists, readFileAsString } from '../../filesystemUtilities' import { getLogger } from '../../logger' import * as pathutil from '../../utilities/pathUtils' import { getLocalRootVariants } from '../../utilities/pathUtils' -import { sleep } from '../../utilities/timeoutUtils' -import { Timeout } from '../../utilities/timeoutUtils' -import { getWorkspaceRelativePath } from '../../utilities/workspaceUtils' import { DefaultSamLocalInvokeCommand, waitForDebuggerMessages } from '../cli/samCliLocalInvoke' import { runLambdaFunction } from '../localLambdaRunner' import { SamLaunchRequestArgs } from './awsSamDebugger' @@ -40,7 +36,6 @@ async function makePythonDebugManifest(params: { isImageLambda: boolean samProjectCodeRoot: string outputDir: string - useIkpdb: boolean }): Promise { let manifestText = '' const manfestPath = path.join(params.samProjectCodeRoot, 'requirements.txt') @@ -50,18 +45,9 @@ async function makePythonDebugManifest(params: { manifestText = await readFileAsString(manfestPath) } getLogger().debug(`pythonCodeLensProvider.makePythonDebugManifest params: %O`, params) - // TODO: If another module name includes the string "ikp3db", this will be skipped... - // HACK: Cloud9-created Lambdas hardcode ikp3db 1.1.4, which only functions with Python 3.6 (which we don't support) - // Remove any ikp3db dependency if it exists and manually add a non-pinned ikp3db dependency. - if (params.useIkpdb) { - manifestText = manifestText.replace(/[ \t]*ikp3db\b[^\r\n]*/, '') - manifestText += `${os.EOL}ikp3db` - await fs.writeFile(debugManifestPath, manifestText) - return debugManifestPath - } // TODO: If another module name includes the string "debugpy", this will be skipped... - if (!params.useIkpdb && !manifestText.includes('debugpy')) { + if (!manifestText.includes('debugpy')) { manifestText += `${os.EOL}debugpy>=1.0,<2` await fs.writeFile(debugManifestPath, manifestText) @@ -76,9 +62,7 @@ async function makePythonDebugManifest(params: { * * Does NOT execute/invoke SAM, docker, etc. */ -export async function makePythonDebugConfig( - config: SamLaunchRequestArgs -): Promise { +export async function makePythonDebugConfig(config: SamLaunchRequestArgs): Promise { if (!config.baseBuildDir) { throw Error('invalid state: config.baseBuildDir was not set') } @@ -97,63 +81,22 @@ export async function makePythonDebugConfig( if (!config.noDebug) { const isImageLambda = await isImageLambdaConfig(config) - if (!config.useIkpdb) { - // Mounted in the Docker container as: /tmp/lambci_debug_files - config.debuggerPath = globals.context.asAbsolutePath(path.join('resources', 'debugger')) - // NOTE: SAM CLI splits on each *single* space in `--debug-args`! - // Extra spaces will be passed as spurious "empty" arguments :( - const debugArgs = `${debugpyWrapperPath} --listen 0.0.0.0:${config.debugPort} --wait-for-client --log-to-stderr` - if (isImageLambda) { - const params = getPythonExeAndBootstrap(config.runtime) - config.debugArgs = [`${params.python} ${debugArgs} ${params.bootstrap}`] - } else { - config.debugArgs = [debugArgs] - } + // Mounted in the Docker container as: /tmp/lambci_debug_files + config.debuggerPath = globals.context.asAbsolutePath(path.join('resources', 'debugger')) + // NOTE: SAM CLI splits on each *single* space in `--debug-args`! + // Extra spaces will be passed as spurious "empty" arguments :( + const debugArgs = `${debugpyWrapperPath} --listen 0.0.0.0:${config.debugPort} --wait-for-client --log-to-stderr` + if (isImageLambda) { + const params = getPythonExeAndBootstrap(config.runtime) + config.debugArgs = [`${params.python} ${debugArgs} ${params.bootstrap}`] } else { - // -ikpdb-log: https://ikpdb.readthedocs.io/en/1.x/api.html?highlight=log#ikpdb.IKPdbLogger - // n,N: Network (noisy) - // b,B: Breakpoints - // e,E: Expression evaluation - // x,X: Execution - // f,F: Frame - // p,P: Path manipulation - // g,G: Global debugger - // - // Level "G" is not too noisy, and is required because it emits the - // "IKP3db listening on" string (`WAIT_FOR_DEBUGGER_MESSAGES`). - const logArg = getLogger().logLevelEnabled('debug') ? '--ikpdb-log=BEXFPG' : '--ikpdb-log=G' - const ccwd = pathutil.normalize( - getWorkspaceRelativePath(config.codeRoot, { workspaceFolders: [config.workspaceFolder] }) - ?.relativePath ?? 'error' - ) - - // NOTE: SAM CLI splits on each *single* space in `--debug-args`! - // Extra spaces will be passed as spurious "empty" arguments :( - // - // -u: (python arg) unbuffered binary stdout/stderr - // - // -ik_ccwd: Must be relative to /var/task, because ikpdb tries to - // resolve filepaths in the Docker container and produces - // nonsense as a "fallback". See `ikp3db.py:normalize_path_in()`: - // https://github.com/cmorisse/ikp3db/blob/eda176a1d4e0b1167466705a26ae4dd5c4188d36/ikp3db.py#L659 - // --ikpdb-protocol=vscode: - // For https://github.com/cmorisse/vscode-ikp3db - // Requires ikp3db 1.5 (unreleased): https://github.com/cmorisse/ikp3db/pull/12 - const debugArgs = `-m ikp3db --ikpdb-address=0.0.0.0 --ikpdb-port=${config.debugPort} -ik_ccwd=${ccwd} -ik_cwd=/var/task ${logArg}` - - if (isImageLambda) { - const params = getPythonExeAndBootstrap(config.runtime) - config.debugArgs = [`${params.python} ${debugArgs} ${params.bootstrap}`] - } else { - config.debugArgs = [debugArgs] - } + config.debugArgs = [debugArgs] } manifestPath = await makePythonDebugManifest({ isImageLambda: isImageLambda, samProjectCodeRoot: config.codeRoot, outputDir: config.baseBuildDir, - useIkpdb: !!config.useIkpdb, }) } @@ -169,30 +112,6 @@ export async function makePythonDebugConfig( }) } - if (config.useIkpdb) { - // Documentation: - // https://github.com/cmorisse/vscode-ikp3db/blob/master/documentation/debug_configurations_reference.md - return { - ...config, - type: 'ikp3db', - request: config.noDebug ? 'launch' : 'attach', - runtimeFamily: RuntimeFamily.Python, - manifestPath: manifestPath, - sam: { - ...config.sam, - // Needed to build ikp3db which has a C build step. - // https://github.com/aws/aws-sam-cli/issues/1840 - containerBuild: true, - }, - - // cloud9 debugger fields: - port: config.debugPort ?? -1, - localRoot: config.codeRoot, - remoteRoot: '/var/task', - address: 'localhost', - } - } - // Make debugpy output log information if our loglevel is at 'debug' if (!config.noDebug && getLogger().logLevelEnabled('debug')) { config.debugArgs![0] += ' --debug' @@ -224,29 +143,13 @@ export async function invokePythonLambda( ctx: ExtContext, config: PythonDebugConfiguration ): Promise { - config.samLocalInvokeCommand = new DefaultSamLocalInvokeCommand([ - waitForDebuggerMessages.PYTHON, - waitForDebuggerMessages.PYTHON_IKPDB, - ]) + config.samLocalInvokeCommand = new DefaultSamLocalInvokeCommand([waitForDebuggerMessages.PYTHON]) - // Must not used waitForPort() for ikpdb: the socket consumes - // ikpdb's initial message and ikpdb does not have a --wait-for-client - // mode, then cloud9 never sees the init message and waits forever. - // - // eslint-disable-next-line @typescript-eslint/unbound-method - config.onWillAttachDebugger = config.useIkpdb ? waitForIkpdb : undefined + config.onWillAttachDebugger = undefined const c = (await runLambdaFunction(ctx, config, async () => {})) as PythonDebugConfiguration return c } -async function waitForIkpdb(debugPort: number, timeout: Timeout) { - // HACK: - // - We cannot consumed the first message on the socket. - // - We must wait for the debugger to be ready, else cloud9 startDebugging() waits forever. - getLogger().info('waitForIkpdb: wait 2 seconds') - await sleep(2000) -} - function getPythonExeAndBootstrap(runtime: Runtime) { // unfortunately new 'Image'-base images did not standardize the paths // https://github.com/aws/aws-sam-cli/blob/7d5101a8edeb575b6925f9adecf28f47793c403c/samcli/local/docker/lambda_debug_settings.py diff --git a/packages/core/src/shared/sam/processTerminal.ts b/packages/core/src/shared/sam/processTerminal.ts index 1482db35d81..a12dccb83d5 100644 --- a/packages/core/src/shared/sam/processTerminal.ts +++ b/packages/core/src/shared/sam/processTerminal.ts @@ -5,12 +5,9 @@ import * as vscode from 'vscode' import { ToolkitError, UnknownError } from '../errors' -import globals from '../extensionGlobals' -import { isCloud9 } from '../extensionUtilities' import { ChildProcess, ChildProcessResult } from '../utilities/processUtils' import { CancellationError } from '../utilities/timeoutUtils' import { getLogger } from '../logger' -import { removeAnsi } from '../utilities/textUtilities' import { isAutomation } from '../vscode/env' import { throwIfErrorMatches } from './utils' @@ -29,19 +26,6 @@ export async function runInTerminal(proc: ChildProcess, cmd: string) { } } - // `createTerminal` doesn't work on C9 so we use the output channel instead - if (isCloud9()) { - globals.outputChannel.show() - - const result = proc.run({ - onStdout: (text) => globals.outputChannel.append(removeAnsi(text)), - onStderr: (text) => globals.outputChannel.append(removeAnsi(text)), - }) - await proc.send('\n') - - return handleResult(await result) - } - // The most recent terminal won't get garbage collected until the next run if (oldTerminal?.stopped === true) { oldTerminal.close() diff --git a/packages/core/src/shared/settings.ts b/packages/core/src/shared/settings.ts index 258daa99b5c..5e157ba4605 100644 --- a/packages/core/src/shared/settings.ts +++ b/packages/core/src/shared/settings.ts @@ -747,7 +747,6 @@ export class Experiments extends Settings.define( const devSettings = { crashCheckInterval: Number, logfile: String, - forceCloud9: Boolean, forceDevMode: Boolean, forceInstallTools: Boolean, forceResolveEnv: Boolean, diff --git a/packages/core/src/shared/telemetry/activation.ts b/packages/core/src/shared/telemetry/activation.ts index 5b1ba3e5a56..f266787681c 100644 --- a/packages/core/src/shared/telemetry/activation.ts +++ b/packages/core/src/shared/telemetry/activation.ts @@ -12,7 +12,7 @@ import * as vscode from 'vscode' import { AwsContext } from '../awsContext' import { DefaultTelemetryService } from './telemetryService' import { getLogger } from '../logger' -import { getComputeRegion, isAmazonQ, isCloud9, productName } from '../extensionUtilities' +import { getComputeRegion, isAmazonQ, productName } from '../extensionUtilities' import { openSettingsId, Settings } from '../settings' import { getSessionId, TelemetryConfig } from './util' import { isAutomation, isReleaseVersion } from '../vscode/env' @@ -70,7 +70,7 @@ export async function activate( ) // Prompt user about telemetry if they haven't been - if (!isCloud9() && !hasUserSeenTelemetryNotice()) { + if (!hasUserSeenTelemetryNotice()) { showTelemetryNotice() } diff --git a/packages/core/src/shared/telemetry/util.ts b/packages/core/src/shared/telemetry/util.ts index a81dd8fc12d..ce9342add56 100644 --- a/packages/core/src/shared/telemetry/util.ts +++ b/packages/core/src/shared/telemetry/util.ts @@ -245,7 +245,6 @@ export function getUserAgent( */ export type EnvType = | 'cloud9' - | 'cloud9-codecatalyst' | 'cloudDesktop-amzn' | 'codecatalyst' | 'local' @@ -260,10 +259,8 @@ export type EnvType = * Returns the identifier for the environment that the extension is running in. */ export async function getComputeEnvType(): Promise { - if (isCloud9('classic')) { + if (isCloud9()) { return 'cloud9' - } else if (isCloud9('codecatalyst')) { - return 'cloud9-codecatalyst' } else if (isInDevEnv()) { return 'codecatalyst' } else if (isSageMaker()) { diff --git a/packages/core/src/shared/treeview/nodes/awsTreeNodeBase.ts b/packages/core/src/shared/treeview/nodes/awsTreeNodeBase.ts index 4b72ed74d42..316634389d1 100644 --- a/packages/core/src/shared/treeview/nodes/awsTreeNodeBase.ts +++ b/packages/core/src/shared/treeview/nodes/awsTreeNodeBase.ts @@ -4,7 +4,6 @@ */ import { TreeItem, TreeItemCollapsibleState, commands } from 'vscode' -import { isCloud9 } from '../../extensionUtilities' export abstract class AWSTreeNodeBase extends TreeItem { public readonly regionCode?: string @@ -24,10 +23,6 @@ export abstract class AWSTreeNodeBase extends TreeItem { } public refresh(): void { - if (isCloud9()) { - void commands.executeCommand('aws.refreshAwsExplorer', true) - } else { - void commands.executeCommand('aws.refreshAwsExplorerNode', this) - } + void commands.executeCommand('aws.refreshAwsExplorerNode', this) } } diff --git a/packages/core/src/shared/ui/inputPrompter.ts b/packages/core/src/shared/ui/inputPrompter.ts index ad2fa2ac2c8..88292f9d43d 100644 --- a/packages/core/src/shared/ui/inputPrompter.ts +++ b/packages/core/src/shared/ui/inputPrompter.ts @@ -153,8 +153,6 @@ export class InputBoxPrompter extends Prompter { }) this.inputBox.show() }).finally(() => { - // TODO: remove the .hide() call when Cloud9 implements dispose - this.inputBox.hide() this.inputBox.dispose() }) diff --git a/packages/core/src/shared/utilities/messages.ts b/packages/core/src/shared/utilities/messages.ts index a961e983745..54085407d65 100644 --- a/packages/core/src/shared/utilities/messages.ts +++ b/packages/core/src/shared/utilities/messages.ts @@ -8,7 +8,7 @@ import * as nls from 'vscode-nls' import * as localizedText from '../localizedText' import { getLogger } from '../../shared/logger' import { ProgressEntry } from '../../shared/vscode/window' -import { getIdeProperties, isCloud9 } from '../extensionUtilities' +import { getIdeProperties } from '../extensionUtilities' import { sleep } from './timeoutUtils' import { Timeout } from './timeoutUtils' import { addCodiconToString } from './textUtilities' @@ -247,11 +247,6 @@ async function showProgressWithTimeout( if (showAfterMs === 0) { showAfterMs = 1 // Show immediately. } - // Cloud9 doesn't support `ProgressLocation.Notification`. User won't be able to cancel. - if (isCloud9()) { - options.location = vscode.ProgressLocation.Window - } - // See also: codecatalyst.ts:LazyProgress const progressPromise: Promise> = new Promise( (resolve, reject) => { diff --git a/packages/core/src/shared/utilities/textUtilities.ts b/packages/core/src/shared/utilities/textUtilities.ts index 95bfabe37d3..b17b79517b8 100644 --- a/packages/core/src/shared/utilities/textUtilities.ts +++ b/packages/core/src/shared/utilities/textUtilities.ts @@ -7,7 +7,6 @@ import * as vscode from 'vscode' import * as crypto from 'crypto' import * as fs from 'fs' // eslint-disable-line no-restricted-imports import { default as stripAnsi } from 'strip-ansi' -import { isCloud9 } from '../extensionUtilities' import { getLogger } from '../logger' /** @@ -120,10 +119,10 @@ export function getStringHash(text: string | Buffer): string { } /** - * Temporary util while Cloud9 does not have codicon support + * Previously used to add Cloud9 support (no icons). Might be useful in the future, so let's leave it here. */ export function addCodiconToString(codiconName: string, text: string): string { - return isCloud9() ? text : `$(${codiconName}) ${text}` + return `$(${codiconName}) ${text}` } /** diff --git a/packages/core/src/stepFunctions/utils.ts b/packages/core/src/stepFunctions/utils.ts index 8c7e783e6ac..32f48faaeb2 100644 --- a/packages/core/src/stepFunctions/utils.ts +++ b/packages/core/src/stepFunctions/utils.ts @@ -132,13 +132,13 @@ export class StateMachineGraphCache { } if (!cssExists) { - // Help users setup on disconnected C9/VSCode instances. + // Help users setup on disconnected VSCode instances. this.logger.error( `Failed to locate cached State Machine Graph css assets. Expected to find: "${visualizationCssUrl}" at "${this.cssFilePath}"` ) } if (!jsExists) { - // Help users setup on disconnected C9/VSCode instances. + // Help users setup on disconnected VSCode instances. this.logger.error( `Failed to locate cached State Machine Graph js assets. Expected to find: "${visualizationScriptUrl}" at "${this.jsFilePath}"` ) diff --git a/packages/core/src/test/lambda/commands/uploadLambda.test.ts b/packages/core/src/test/lambda/commands/uploadLambda.test.ts index 6a76b08497c..e31fb9088fa 100644 --- a/packages/core/src/test/lambda/commands/uploadLambda.test.ts +++ b/packages/core/src/test/lambda/commands/uploadLambda.test.ts @@ -43,11 +43,6 @@ describe('uploadLambda', async function () { (await findApplicationJsonFile(folderUri))?.fsPath ?? '', path.join(tempFolder, '.application.json') ) - // Also test Cloud9 temporary workaround. - assertEqualPaths( - (await findApplicationJsonFile(folderUri, true))?.fsPath ?? '', - path.join(tempFolder, '.application.json') - ) }) it('finds application.json file from dir path - nested', async function () { @@ -56,8 +51,6 @@ describe('uploadLambda', async function () { await toFile('top secret data', appjsonPath) assertEqualPaths((await findApplicationJsonFile(folderUri))?.fsPath ?? '', appjsonPath) - // Also test Cloud9 temporary workaround. - assertEqualPaths((await findApplicationJsonFile(folderUri, true))?.fsPath ?? '', appjsonPath) }) it('finds application.json file from template file path', async function () { @@ -67,8 +60,6 @@ describe('uploadLambda', async function () { await toFile('top secret data', appjsonPath) assertEqualPaths((await findApplicationJsonFile(templateUri))?.fsPath ?? '', appjsonPath) - // Also test Cloud9 temporary workaround. - assertEqualPaths((await findApplicationJsonFile(templateUri, true))?.fsPath ?? '', appjsonPath) }) it('lists functions from .application.json', async function () { diff --git a/packages/core/src/test/lambda/models/samTemplates.test.ts b/packages/core/src/test/lambda/models/samTemplates.test.ts index e9105adf0b6..4abb3f87315 100644 --- a/packages/core/src/test/lambda/models/samTemplates.test.ts +++ b/packages/core/src/test/lambda/models/samTemplates.test.ts @@ -16,7 +16,6 @@ import { eventBridgeStarterAppTemplate, stepFunctionsSampleApp, typeScriptBackendTemplate, - lazyLoadSamTemplateStrings, } from '../../../lambda/models/samTemplates' import { Set } from 'immutable' @@ -29,8 +28,6 @@ let validGoTemplateOptions: Set let defaultTemplateOptions: Set before(function () { - lazyLoadSamTemplateStrings() - validTemplateOptions = Set([ helloWorldTemplate, eventBridgeHelloWorldTemplate, diff --git a/packages/core/src/test/lambda/vue/samInvokeBackend.test.ts b/packages/core/src/test/lambda/vue/samInvokeBackend.test.ts index d823f5e759a..18ae33b67d0 100644 --- a/packages/core/src/test/lambda/vue/samInvokeBackend.test.ts +++ b/packages/core/src/test/lambda/vue/samInvokeBackend.test.ts @@ -10,7 +10,6 @@ import { SamInvokeWebview, finalizeConfig, } from '../../../lambda/vue/configEditor/samInvokeBackend' -import { ExtContext } from '../../../shared/extensions' import { AwsSamDebuggerConfiguration } from '../../../shared/sam/debugger/awsSamDebugConfiguration' import assert from 'assert' import * as picker from '../../../shared/ui/picker' @@ -22,9 +21,7 @@ import path from 'path' import { addCodiconToString, fs, makeTemporaryToolkitFolder } from '../../../shared' import { LaunchConfiguration } from '../../../shared/debug/launchConfiguration' import { getTestWindow } from '../..' -import * as extensionUtilities from '../../../shared/extensionUtilities' import * as samInvokeBackend from '../../../lambda/vue/configEditor/samInvokeBackend' -import { SamDebugConfigProvider } from '../../../shared/sam/debugger/awsSamDebugger' import sinon from 'sinon' import * as nls from 'vscode-nls' import { assertLogsContain } from '../../../test/globalSetup.test' @@ -69,13 +66,11 @@ const mockConfig: AwsSamDebuggerConfigurationLoose = { describe('SamInvokeWebview', () => { let samInvokeWebview: SamInvokeWebview - let mockExtContext: ExtContext let sandbox: sinon.SinonSandbox beforeEach(() => { - mockExtContext = {} as ExtContext sandbox = sinon.createSandbox() - samInvokeWebview = new SamInvokeWebview(mockExtContext, mockConfig, mockResourceData) + samInvokeWebview = new SamInvokeWebview(mockConfig, mockResourceData) }) afterEach(() => { @@ -83,7 +78,7 @@ describe('SamInvokeWebview', () => { }) it('should return undefined when no resource data is provided', () => { - const noResourceWebview = new SamInvokeWebview(mockExtContext, mockConfig, undefined) + const noResourceWebview = new SamInvokeWebview(mockConfig, undefined) const data = noResourceWebview.getResourceData() // Using assert to check if the data is undefined @@ -580,9 +575,8 @@ describe('SamInvokeWebview', () => { sandbox.restore() }) - it('should invoke launch config for non-Cloud9 environment', async () => { + it('should invoke launch config', async () => { workspaceFoldersStub.value([mockFolder]) - sandbox.stub(extensionUtilities, 'isCloud9').returns(false) sandbox.replace(samInvokeWebview as any, 'getUriFromLaunchConfig', getUriFromLaunchConfigStub) getUriFromLaunchConfigStub.resolves(mockUri) @@ -592,27 +586,6 @@ describe('SamInvokeWebview', () => { assert(startDebuggingStub.called) }) - - it('should invoke launch config for Cloud9 environment', async () => { - workspaceFoldersStub.value([mockFolder]) - sandbox.stub(extensionUtilities, 'isCloud9').returns(true) - sandbox.replace(samInvokeWebview as any, 'getUriFromLaunchConfig', getUriFromLaunchConfigStub) - getUriFromLaunchConfigStub.resolves(mockUri) - - const startDebuggingStub = sandbox.stub(vscode.debug, 'startDebugging').resolves(true) - - await samInvokeWebview.invokeLaunchConfig(mockConfig) - - assert(startDebuggingStub.notCalled) - }) - it('should use SamDebugConfigProvider for Cloud9 environment', async () => { - sandbox.stub(extensionUtilities, 'isCloud9').returns(true) - const SamDebugConfigProviderStub = sinon.stub(SamDebugConfigProvider.prototype, 'resolveDebugConfiguration') - - await samInvokeWebview.invokeLaunchConfig(mockConfig) - - assert(SamDebugConfigProviderStub.called) - }) }) describe('saveLaunchConfig', function () { let sandbox: sinon.SinonSandbox @@ -701,7 +674,6 @@ describe('SamInvokeWebview', () => { }) it('should not save launch config', async () => { workspaceFoldersStub.value([mockFolder]) - sandbox.stub(extensionUtilities, 'isCloud9').returns(false) sandbox.replace(samInvokeWebview as any, 'getUriFromLaunchConfig', getUriFromLaunchConfigStub) const launchConfigItems = launchConfigurationsStub.resolves([]) getUriFromLaunchConfigStub.resolves(mockUri) @@ -782,7 +754,6 @@ describe('SamInvokeWebview', () => { it('should save launch config', async () => { workspaceFoldersStub.value([mockFolder]) - sandbox.stub(extensionUtilities, 'isCloud9').returns(false) getUriFromLaunchConfigStub.resolves(mockUri) sandbox.replace(samInvokeWebview as any, 'getUriFromLaunchConfig', getUriFromLaunchConfigStub) const launchConfigItems = launchConfigurationsStub.resolves([ diff --git a/packages/core/src/test/shared/datetime.test.ts b/packages/core/src/test/shared/datetime.test.ts index d7320e50ce0..1bac62cf078 100644 --- a/packages/core/src/test/shared/datetime.test.ts +++ b/packages/core/src/test/shared/datetime.test.ts @@ -11,8 +11,7 @@ import { globals } from '../../shared' describe('simple tests', () => { it('formatLocalized()', async function () { const d = new globals.clock.Date(globals.clock.Date.UTC(2013, 11, 17, 3, 24, 0)) - assert.deepStrictEqual(formatLocalized(d, false), 'Dec 16, 2013 7:24:00 PM GMT-8') - assert.deepStrictEqual(formatLocalized(d, true), 'Dec 16, 2013 7:24:00 PM PST') + assert.deepStrictEqual(formatLocalized(d), 'Dec 16, 2013 7:24:00 PM GMT-8') }) it('formatDateTimestamp()', async function () { diff --git a/packages/core/src/test/shared/fs/fs.test.ts b/packages/core/src/test/shared/fs/fs.test.ts index ad8d8777462..c816ecdde83 100644 --- a/packages/core/src/test/shared/fs/fs.test.ts +++ b/packages/core/src/test/shared/fs/fs.test.ts @@ -14,7 +14,6 @@ import fs, { FileSystem } from '../../../shared/fs/fs' import * as os from 'os' import { isMinVscode, isWin } from '../../../shared/vscode/env' import Sinon from 'sinon' -import * as extensionUtilities from '../../../shared/extensionUtilities' import { PermissionsError, formatError, isFileNotFoundError, scrubNames } from '../../../shared/errors' import { EnvironmentVariables } from '../../../shared/environmentVariables' import * as testutil from '../../testUtil' @@ -227,20 +226,6 @@ describe('FileSystem', function () { }) }) - // eslint-disable-next-line unicorn/no-array-for-each - paths.forEach(async function (p) { - it(`creates folder but uses the "fs" module if in Cloud9: '${p}'`, async function () { - sandbox.stub(extensionUtilities, 'isCloud9').returns(true) - const dirPath = testFolder.pathFrom(p) - const mkdirSpy = sandbox.spy(nodefs, 'mkdir') - - await fs.mkdir(dirPath) - - assert(existsSync(dirPath)) - assert.deepStrictEqual(mkdirSpy.args[0], [dirPath, { recursive: true }]) - }) - }) - it('does NOT throw if dir already exists', async function () { // We do not always want this behavior, but it seems that this is how the vsc implementation // does it. Look at the Node FS implementation instead as that throws if the dir already exists. @@ -281,32 +266,6 @@ describe('FileSystem', function () { function sorted(i: [string, vscode.FileType][]) { return i.sort((a, b) => a[0].localeCompare(b[0])) } - - it('uses the "fs" readdir implementation if in Cloud9', async function () { - sandbox.stub(extensionUtilities, 'isCloud9').returns(true) - const readdirSpy = sandbox.spy(nodefs, 'readdir') - - await testFolder.write('a.txt') - await testFolder.write('b.txt') - await testFolder.write('c.txt') - mkdirSync(testFolder.pathFrom('dirA')) - mkdirSync(testFolder.pathFrom('dirB')) - mkdirSync(testFolder.pathFrom('dirC')) - - const files = await fs.readdir(testFolder.path) - assert.deepStrictEqual( - sorted(files), - sorted([ - ['a.txt', vscode.FileType.File], - ['b.txt', vscode.FileType.File], - ['c.txt', vscode.FileType.File], - ['dirA', vscode.FileType.Directory], - ['dirB', vscode.FileType.Directory], - ['dirC', vscode.FileType.Directory], - ]) - ) - assert(readdirSpy.calledOnce) - }) }) describe('copy()', function () { @@ -360,19 +319,6 @@ describe('FileSystem', function () { assert(!existsSync(f)) await assert.rejects(() => fs.delete(f)) }) - - it('uses "node:fs" rm() if in Cloud9', async function () { - sandbox.stub(extensionUtilities, 'isCloud9').returns(true) - const rmdirSpy = sandbox.spy(nodefs, 'rm') - // Folder with subfolders - const dirPath = await testFolder.mkdir('a/b/deleteMe') - mkdirSync(dirPath, { recursive: true }) - - await fs.delete(dirPath, { recursive: true }) - - assert(rmdirSpy.calledOnce) - assert(!existsSync(dirPath)) - }) }) describe('stat()', function () { diff --git a/packages/core/src/test/shared/icons.test.ts b/packages/core/src/test/shared/icons.test.ts index 3fd1feaf373..edca2647d42 100644 --- a/packages/core/src/test/shared/icons.test.ts +++ b/packages/core/src/test/shared/icons.test.ts @@ -12,51 +12,12 @@ import { fs } from '../../shared' describe('getIcon', function () { it('returns a ThemeIcon for `vscode` codicons', function () { - const icon = getIcon('vscode-gear', false) + const icon = getIcon('vscode-gear') assert.ok(icon instanceof ThemeIcon) assert.strictEqual(icon.id, 'gear') }) - it('returns a ThemeIcon for `aws` icons', function () { - const icon = getIcon('aws-cdk-logo', false) - - assert.ok(icon instanceof ThemeIcon) - assert.strictEqual(icon.id, 'aws-cdk-logo') - }) - - it('returns icon URIs for non-codicon icons', function () { - const icon = getIcon('vscode-help', false) - - assert.ok(!(icon instanceof ThemeIcon)) - assert.ok(icon.dark.path.endsWith('/resources/icons/vscode/dark/help.svg')) - assert.ok(icon.light.path.endsWith('/resources/icons/vscode/light/help.svg')) - }) - - it('can use specific icons for Cloud9', function () { - const icon = getIcon('vscode-help', true) - - assert.ok(!(icon instanceof ThemeIcon)) - assert.ok(icon.dark.path.endsWith('/resources/icons/cloud9/dark/vscode-help.svg')) - assert.ok(icon.light.path.endsWith('/resources/icons/cloud9/light/vscode-help.svg')) - }) - - it('can use generated icons for Cloud9', function () { - const icon = getIcon('aws-cdk-logo', true) - - assert.ok(!(icon instanceof ThemeIcon)) - assert.ok(icon.dark.path.endsWith('/resources/icons/cloud9/generated/dark/aws-cdk-logo.svg')) - assert.ok(icon.light.path.endsWith('/resources/icons/cloud9/generated/light/aws-cdk-logo.svg')) - }) - - it('can use codicons for Cloud9', function () { - const icon = getIcon('vscode-gear', true) - - assert.ok(!(icon instanceof ThemeIcon)) - assert.ok(icon.dark.path.endsWith('/resources/icons/cloud9/generated/dark/vscode-gear.svg')) - assert.ok(icon.light.path.endsWith('/resources/icons/cloud9/generated/light/vscode-gear.svg')) - }) - it('can use overrides for contributed icons', async function () { const tempDir = await makeTemporaryToolkitFolder() @@ -72,7 +33,7 @@ describe('getIcon', function () { await fs.writeFile(p, '') } - const icon = getIcon('aws-cdk-logo', false, tempDir) + const icon = getIcon('aws-cdk-logo', tempDir) assert.ok(!(icon instanceof ThemeIcon)) assert.strictEqual(icon.dark.fsPath, Uri.file(paths[1]).fsPath) @@ -90,7 +51,7 @@ describe('getIcon', function () { await fs.mkdir(path.dirname(logoPath)) await fs.writeFile(logoPath, '') - const icon = getIcon('aws-cdk-logo', false, tempDir) + const icon = getIcon('aws-cdk-logo', tempDir) assert.ok(icon instanceof ThemeIcon) assert.strictEqual(icon.source?.fsPath, Uri.file(logoPath).fsPath) diff --git a/packages/core/src/test/shared/sam/cli/samCliInit.test.ts b/packages/core/src/test/shared/sam/cli/samCliInit.test.ts index 9ee8d889368..854fdc91610 100644 --- a/packages/core/src/test/shared/sam/cli/samCliInit.test.ts +++ b/packages/core/src/test/shared/sam/cli/samCliInit.test.ts @@ -9,7 +9,6 @@ import { eventBridgeStarterAppTemplate, getSamCliTemplateParameter, helloWorldTemplate, - lazyLoadSamTemplateStrings, } from '../../../../lambda/models/samTemplates' import { SamCliContext } from '../../../../shared/sam/cli/samCliContext' import { runSamCliInit, SamCliInitArgs } from '../../../../shared/sam/cli/samCliInit' @@ -52,8 +51,6 @@ describe('runSamCliInit', async function () { let sampleSamInitArgs: SamCliInitArgs before(function () { - lazyLoadSamTemplateStrings() - sampleSamInitArgs = { name: 'qwerty', location: '/some/path/to/code.js', @@ -198,8 +195,6 @@ describe('runSamCliInit', async function () { let samInitArgsWithExtraContent: SamCliInitArgs before(function () { - lazyLoadSamTemplateStrings() - // eslint-disable-next-line @typescript-eslint/naming-convention extraContent = { AWS_Schema_registry: 'testRegistry', diff --git a/packages/core/src/test/shared/sam/debugger/samDebugConfigProvider.test.ts b/packages/core/src/test/shared/sam/debugger/samDebugConfigProvider.test.ts index cf9586c9a28..9fe7c76e842 100644 --- a/packages/core/src/test/shared/sam/debugger/samDebugConfigProvider.test.ts +++ b/packages/core/src/test/shared/sam/debugger/samDebugConfigProvider.test.ts @@ -555,7 +555,6 @@ describe('SamDebugConfigurationProvider', async function () { request: 'attach', // Input "direct-invoke", output "attach". runtime: 'nodejs18.x', runtimeFamily: lambdaModel.RuntimeFamily.NodeJS, - useIkpdb: false, workspaceFolder: { index: 0, name: 'test-workspace-folder', @@ -721,7 +720,6 @@ describe('SamDebugConfigurationProvider', async function () { request: 'attach', // Input "direct-invoke", output "attach". runtime: 'nodejs18.x', runtimeFamily: lambdaModel.RuntimeFamily.NodeJS, - useIkpdb: false, workspaceFolder: { index: 0, name: 'test-workspace-folder', @@ -881,7 +879,6 @@ describe('SamDebugConfigurationProvider', async function () { request: 'attach', // Input "direct-invoke", output "attach". runtime: 'nodejs20.x', runtimeFamily: lambdaModel.RuntimeFamily.NodeJS, - useIkpdb: false, workspaceFolder: { index: 0, name: 'test-workspace-folder', @@ -1008,7 +1005,6 @@ describe('SamDebugConfigurationProvider', async function () { request: 'attach', // Input "direct-invoke", output "attach". runtime: 'nodejs18.x', runtimeFamily: lambdaModel.RuntimeFamily.NodeJS, - useIkpdb: false, workspaceFolder: { index: 0, name: 'test-workspace-folder', @@ -1147,7 +1143,6 @@ describe('SamDebugConfigurationProvider', async function () { request: 'attach', // Input "direct-invoke", output "attach". runtime: 'nodejs20.x', runtimeFamily: lambdaModel.RuntimeFamily.NodeJS, - useIkpdb: false, workspaceFolder: { index: 0, name: 'test-workspace-folder', @@ -1228,7 +1223,6 @@ describe('SamDebugConfigurationProvider', async function () { request: 'attach', // Input "direct-invoke", output "attach". runtime: 'java17', runtimeFamily: lambdaModel.RuntimeFamily.Java, - useIkpdb: false, type: AWS_SAM_DEBUG_TYPE, workspaceFolder: { index: 0, @@ -1331,7 +1325,6 @@ describe('SamDebugConfigurationProvider', async function () { request: 'attach', // Input "direct-invoke", output "attach". runtime: 'java17', runtimeFamily: lambdaModel.RuntimeFamily.Java, - useIkpdb: false, type: AWS_SAM_DEBUG_TYPE, workspaceFolder: { index: 0, @@ -1444,7 +1437,6 @@ describe('SamDebugConfigurationProvider', async function () { request: 'attach', // Input "direct-invoke", output "attach". runtime: 'java17', runtimeFamily: lambdaModel.RuntimeFamily.Java, - useIkpdb: false, type: AWS_SAM_DEBUG_TYPE, workspaceFolder: { index: 0, @@ -1543,7 +1535,6 @@ describe('SamDebugConfigurationProvider', async function () { request: 'attach', // Input "direct-invoke", output "attach". runtime: 'java11', runtimeFamily: lambdaModel.RuntimeFamily.Java, - useIkpdb: false, type: AWS_SAM_DEBUG_TYPE, workspaceFolder: { index: 0, @@ -1640,7 +1631,6 @@ describe('SamDebugConfigurationProvider', async function () { request: 'attach', // Input "direct-invoke", output "attach". runtime: 'dotnet6', // lambdaModel.dotNetRuntimes[0], runtimeFamily: lambdaModel.RuntimeFamily.DotNet, - useIkpdb: false, type: AWS_SAM_DEBUG_TYPE, workspaceFolder: { index: 0, @@ -1809,7 +1799,6 @@ describe('SamDebugConfigurationProvider', async function () { request: 'attach', // Input "direct-invoke", output "attach". runtime: 'dotnet6', // lambdaModel.dotNetRuntimes[0], runtimeFamily: lambdaModel.RuntimeFamily.DotNet, - useIkpdb: false, type: AWS_SAM_DEBUG_TYPE, workspaceFolder: { index: 0, @@ -1964,7 +1953,6 @@ describe('SamDebugConfigurationProvider', async function () { request: 'attach', // Input "direct-invoke", output "attach". runtime: 'dotnet6', // lambdaModel.dotNetRuntimes[0], runtimeFamily: lambdaModel.RuntimeFamily.DotNet, - useIkpdb: false, type: AWS_SAM_DEBUG_TYPE, workspaceFolder: { index: 0, @@ -2129,7 +2117,6 @@ describe('SamDebugConfigurationProvider', async function () { request: 'attach', // Input "direct-invoke", output "attach". runtime: 'python3.7', runtimeFamily: lambdaModel.RuntimeFamily.Python, - useIkpdb: false, type: AWS_SAM_DEBUG_TYPE, handlerName: 'app.lambda_handler', workspaceFolder: { @@ -2275,7 +2262,6 @@ describe('SamDebugConfigurationProvider', async function () { request: 'attach', // Input "direct-invoke", output "attach". runtime: 'python3.7', runtimeFamily: lambdaModel.RuntimeFamily.Python, - useIkpdb: false, type: AWS_SAM_DEBUG_TYPE, handlerName: 'app.lambda_handler', workspaceFolder: { @@ -2401,7 +2387,6 @@ describe('SamDebugConfigurationProvider', async function () { request: 'attach', // Input "direct-invoke", output "attach". runtime: 'python3.7', runtimeFamily: lambdaModel.RuntimeFamily.Python, - useIkpdb: false, type: AWS_SAM_DEBUG_TYPE, handlerName: 'app.lambda_handler', workspaceFolder: { @@ -2493,7 +2478,6 @@ describe('SamDebugConfigurationProvider', async function () { request: 'attach', // Input "direct-invoke", output "attach". runtime: 'python3.7', runtimeFamily: lambdaModel.RuntimeFamily.Python, - useIkpdb: false, type: AWS_SAM_DEBUG_TYPE, handlerName: 'HelloWorldFunction', workspaceFolder: { @@ -2635,207 +2619,6 @@ describe('SamDebugConfigurationProvider', async function () { getLogger().setLogLevel('debug') }) - it('target=code: ikpdb, python 3.7', async function () { - const appDir = pathutil.normalize( - path.join(testutil.getProjectDir(), 'testFixtures/workspaceFolder/python3.7-plain-sam-app') - ) - const folder = testutil.getWorkspaceFolder(appDir) - const input = { - type: AWS_SAM_DEBUG_TYPE, - name: 'test: ikpdb target=code', - request: DIRECT_INVOKE_TYPE, - invokeTarget: { - target: CODE_TARGET_TYPE, - lambdaHandler: 'app.lambda_handler', - projectRoot: 'hello_world', - }, - lambda: { - runtime: 'python3.7', - payload: { - path: `${appDir}/events/event.json`, - }, - }, - // Force ikpdb in non-cloud9 environment. - useIkpdb: true, - } - - // Invoke with noDebug=false (the default). - const actual = (await debugConfigProvider.makeConfig(folder, input))! - // Expected result with noDebug=false. - const expected: SamLaunchRequestArgs = { - awsCredentials: fakeCredentials, - request: 'attach', // Input "direct-invoke", output "attach". - runtime: 'python3.7', - runtimeFamily: lambdaModel.RuntimeFamily.Python, - useIkpdb: true, - type: AWS_SAM_DEBUG_TYPE, - handlerName: 'app.lambda_handler', - workspaceFolder: { - index: 0, - name: 'test-workspace-folder', - uri: vscode.Uri.file(appDir), - }, - baseBuildDir: actual.baseBuildDir, // Random, sanity-checked by assertEqualLaunchConfigs(). - envFile: undefined, - eventPayloadFile: `${actual.baseBuildDir}/event.json`, - codeRoot: pathutil.normalize(path.join(appDir, 'hello_world')), - debugArgs: [ - `-m ikp3db --ikpdb-address=0.0.0.0 --ikpdb-port=${actual.debugPort} -ik_ccwd=hello_world -ik_cwd=/var/task --ikpdb-log=BEXFPG`, - ], - apiPort: actual.apiPort, - debugPort: actual.debugPort, - documentUri: vscode.Uri.file(''), // TODO: remove or test. - invokeTarget: { ...input.invokeTarget }, - lambda: { - ...input.lambda, - environmentVariables: {}, - memoryMb: undefined, - timeoutSec: undefined, - }, - sam: { - containerBuild: true, - }, - name: input.name, - templatePath: pathutil.normalize(path.join(actual.baseBuildDir!, 'app___vsctk___template.yaml')), - parameterOverrides: undefined, - architecture: undefined, - region: 'us-west-2', - - // - // Python-ikpdb fields - // - port: actual.debugPort, - address: 'localhost', - localRoot: pathutil.normalize(path.join(appDir, 'hello_world')), - remoteRoot: '/var/task', - } - - assertEqualLaunchConfigs(actual, expected) - assert.strictEqual( - await fs.readFileText(actual.eventPayloadFile!), - await fs.readFileText(input.lambda.payload.path) - ) - await assertFileText( - expected.templatePath, - `Resources: - helloworld: - Type: AWS::Serverless::Function - Properties: - Handler: ${expected.handlerName} - CodeUri: >- - ${expected.codeRoot} - Runtime: python3.7 -` - ) - - // - // Test noDebug=true. - // - ;(input as any).noDebug = true - const actualNoDebug = (await debugConfigProvider.makeConfig(folder, input))! as SamLaunchRequestArgs - const expectedNoDebug: SamLaunchRequestArgs = { - ...expected, - noDebug: true, - request: 'launch', - debugPort: undefined, - port: -1, - handlerName: 'app.lambda_handler', - baseBuildDir: actualNoDebug.baseBuildDir, - envFile: undefined, - eventPayloadFile: `${actualNoDebug.baseBuildDir}/event.json`, - } - assertEqualLaunchConfigs(actualNoDebug, expectedNoDebug) - }) - - it('target=template: ikpdb, python 3.7 (deep project tree)', async function () { - // To test a deeper tree, use "testFixtures/workspaceFolder/" as the root. - const appDir = pathutil.normalize(path.join(testutil.getProjectDir(), 'testFixtures/workspaceFolder/')) - const folder = testutil.getWorkspaceFolder(appDir) - const input = { - type: AWS_SAM_DEBUG_TYPE, - name: 'test-py37-template', - request: DIRECT_INVOKE_TYPE, - invokeTarget: { - target: TEMPLATE_TARGET_TYPE, - templatePath: 'python3.7-plain-sam-app/template.yaml', - logicalId: 'HelloWorldFunction', - }, - // Force ikpdb in non-cloud9 environment. - useIkpdb: true, - } - const templatePath = vscode.Uri.file(path.join(appDir, 'python3.7-plain-sam-app/template.yaml')) - - // Invoke with noDebug=false (the default). - const actual = (await debugConfigProvider.makeConfig(folder, input))! - // Expected result with noDebug=false. - const expected: SamLaunchRequestArgs = { - awsCredentials: fakeCredentials, - request: 'attach', // Input "direct-invoke", output "attach". - runtime: 'python3.7', - runtimeFamily: lambdaModel.RuntimeFamily.Python, - useIkpdb: true, - type: AWS_SAM_DEBUG_TYPE, - handlerName: 'app.lambda_handler', - workspaceFolder: { - index: 0, - name: 'test-workspace-folder', - uri: vscode.Uri.file(appDir), - }, - baseBuildDir: actual.baseBuildDir, // Random, sanity-checked by assertEqualLaunchConfigs(). - envFile: undefined, - eventPayloadFile: undefined, - codeRoot: pathutil.normalize(path.join(appDir, 'python3.7-plain-sam-app/hello_world')), - apiPort: undefined, - debugArgs: [ - `-m ikp3db --ikpdb-address=0.0.0.0 --ikpdb-port=${actual.debugPort} -ik_ccwd=python3.7-plain-sam-app/hello_world -ik_cwd=/var/task --ikpdb-log=BEXFPG`, - ], - debugPort: actual.debugPort, - documentUri: vscode.Uri.file(''), // TODO: remove or test. - invokeTarget: { ...input.invokeTarget }, - lambda: { - environmentVariables: {}, - memoryMb: undefined, - timeoutSec: 3, - }, - sam: { - containerBuild: true, - }, - name: input.name, - templatePath: pathutil.normalize(path.join(path.dirname(templatePath.fsPath), 'template.yaml')), - parameterOverrides: undefined, - architecture: undefined, - region: 'us-west-2', - - // - // Python-ikpdb fields - // - port: actual.debugPort, - address: 'localhost', - localRoot: pathutil.normalize(path.join(appDir, 'hello_world')), - remoteRoot: '/var/task', - } - - assertEqualLaunchConfigs(actual, expected) - - // - // Test noDebug=true. - // - ;(input as any).noDebug = true - const actualNoDebug = (await debugConfigProvider.makeConfig(folder, input))! - const expectedNoDebug: SamLaunchRequestArgs = { - ...expected, - noDebug: true, - request: 'launch', - debugPort: undefined, - port: -1, - handlerName: 'app.lambda_handler', - baseBuildDir: actualNoDebug.baseBuildDir, - envFile: undefined, - eventPayloadFile: undefined, - } - assertEqualLaunchConfigs(actualNoDebug, expectedNoDebug) - }) - it('debugconfig with "aws" section', async function () { // Simluates credentials in "aws.credentials" launch-config field. const configCredentials: Credentials = { @@ -2918,7 +2701,6 @@ describe('SamDebugConfigurationProvider', async function () { awsCredentials: configCredentials, ...awsSection, type: AWS_SAM_DEBUG_TYPE, - useIkpdb: false, workspaceFolder: { index: 0, name: 'test-workspace-folder', @@ -3010,7 +2792,6 @@ describe('SamDebugConfigurationProvider', async function () { request: 'attach', // Input "direct-invoke", output "attach". runtime: 'go1.x', runtimeFamily: lambdaModel.RuntimeFamily.Go, - useIkpdb: false, workspaceFolder: { index: 0, name: 'test-workspace-folder', diff --git a/packages/core/src/test/shared/settings.test.ts b/packages/core/src/test/shared/settings.test.ts index da68ada2cde..a868d6fbe66 100644 --- a/packages/core/src/test/shared/settings.test.ts +++ b/packages/core/src/test/shared/settings.test.ts @@ -276,7 +276,7 @@ describe('Settings', function () { }) describe('DevSetting', function () { - const testSetting = 'forceCloud9' + const testSetting = 'renderDebugDetails' let settings: ClassToInterfaceType let sut: DevSettings diff --git a/packages/core/src/webviews/main.ts b/packages/core/src/webviews/main.ts index 379dc869fd8..1fa18d3c460 100644 --- a/packages/core/src/webviews/main.ts +++ b/packages/core/src/webviews/main.ts @@ -4,7 +4,6 @@ */ import * as vscode from 'vscode' -import { isCloud9 } from '../shared/extensionUtilities' import { Protocol, registerWebviewServer } from './server' import { getIdeProperties } from '../shared/extensionUtilities' import { getFunctions } from '../shared/utilities/classUtils' @@ -345,11 +344,7 @@ export type ClassToProtocol = FilterUnknown & * Creates a brand new webview panel, setting some basic initial parameters and updating the webview. */ function createWebviewPanel(ctx: vscode.ExtensionContext, params: WebviewPanelParams): vscode.WebviewPanel { - // C9 doesn't support 'Beside'. The next best thing is always using the second column. - const viewColumn = - isCloud9() && params.viewColumn === vscode.ViewColumn.Beside - ? vscode.ViewColumn.Two - : (params.viewColumn ?? vscode.ViewColumn.Active) + const viewColumn = params.viewColumn ?? vscode.ViewColumn.Active const panel = vscode.window.createWebviewPanel( params.id, @@ -358,9 +353,10 @@ function createWebviewPanel(ctx: vscode.ExtensionContext, params: WebviewPanelPa { // The redundancy here is to correct a bug with Cloud9's Webview implementation // We need to assign certain things on instantiation, otherwise they'll never be applied to the view + // TODO: Comment is old, no cloud9 support anymore. Is this needed? enableScripts: true, enableCommandUris: true, - retainContextWhenHidden: isCloud9() || params.retainContextWhenHidden, + retainContextWhenHidden: params.retainContextWhenHidden, } ) updateWebview(ctx, panel.webview, params) @@ -392,7 +388,7 @@ function updateWebview(ctx: vscode.ExtensionContext, webview: vscode.Webview, pa ]) const css = resolveRelative(webview, vscode.Uri.joinPath(resources, 'css'), [ - isCloud9() ? 'base-cloud9.css' : 'base.css', + 'base.css', ...(params.cssFiles ?? []), ]) @@ -403,7 +399,7 @@ function updateWebview(ctx: vscode.ExtensionContext, webview: vscode.Webview, pa stylesheets: css.map((p) => `\n`).join('\n'), main: mainScript, webviewJs: params.webviewJs, - cspSource: updateCspSource(webview.cspSource), + cspSource: webview.cspSource, }) return webview @@ -455,12 +451,3 @@ function resolveWebviewHtml(params: { ` } - -/** - * Updates the CSP source for webviews with an allowed source for AWS endpoints when running in - * Cloud9 environments. Possible this can be further scoped to specific C9 CDNs or removed entirely - * if C9 injects this. - */ -export function updateCspSource(baseSource: string) { - return isCloud9() ? `https://*.amazonaws.com ${baseSource}` : baseSource -} diff --git a/packages/toolkit/.changes/next-release/Removal-3ef48be0-d3f3-4252-be69-9a0684406944.json b/packages/toolkit/.changes/next-release/Removal-3ef48be0-d3f3-4252-be69-9a0684406944.json new file mode 100644 index 00000000000..c8d7692200c --- /dev/null +++ b/packages/toolkit/.changes/next-release/Removal-3ef48be0-d3f3-4252-be69-9a0684406944.json @@ -0,0 +1,4 @@ +{ + "type": "Removal", + "description": "Cloud9: Remove all support and compatibility." +} diff --git a/packages/toolkit/README.quickstart.cloud9.md b/packages/toolkit/README.quickstart.cloud9.md deleted file mode 100644 index 2fe1b3f9e36..00000000000 --- a/packages/toolkit/README.quickstart.cloud9.md +++ /dev/null @@ -1,146 +0,0 @@ -# AWS Toolkit - -The AWS Toolkit extension for AWS Cloud9 that enables you to interact with [Amazon Web Services (AWS)](https://aws.amazon.com/what-is-aws/). -See the [user guide](https://docs.aws.amazon.com/cloud9/latest/user-guide/toolkit-welcome.html) for complete documentation. - -Try the [AWS Code Sample Catalog](https://docs.aws.amazon.com/code-samples/latest/catalog/welcome.html) to start coding with the AWS SDK. - -# Features - -- [AWS Explorer](#ui-components-aws-expl) - - API Gateway - - App Runner - - CloudFormation stacks - - [CloudWatch Logs](https://docs.aws.amazon.com/cloud9/latest/user-guide/cloudwatch-logs-toolkit.html) - - ECR - - [ECS](https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/ecs-exec.html) - - IoT explorer - - Lambda functions - - S3 explorer -- [Developer Tools](#ui-components-dev-tools) - - [CDK Explorer](#ui-components-cdk-expl) - - [CodeWhisperer](#codewhisperer) -- [AWS Serverless Applications (SAM)](#sam-and-lambda) -- [`AWS:` Commands](#aws-commands) - ---- - -## AWS Explorer - -The **AWS Explorer** provides access to the AWS services that you can work with when using the Toolkit. To see the **AWS Explorer**, choose the **AWS** icon in the **Activity bar**. - -## ![Overview, AWS Explorer](./resources/marketplace/cloud9/overview-aws-explorer-en.png) - -## Developer Tools - -The **Developer Tools** panel is a section for developer-focused tooling curated for working in an IDE. The **Developer Tools** panel can be found underneath the **AWS Explorer** when the **AWS icon** is selected in the **Activity bar**. - -## { [Return to Top](#top) } - -## CDK Explorer - -The **AWS CDK Explorer** enables you to work with [AWS Cloud Development Kit (CDK)](https://aws.amazon.com/cdk/) applications. It shows a top-level view of your CDK applications that have been sythesized in your workspace. - -With the CDK explorer, you can navigate the CDK application's infrastructure stacks, resources, and policies. - -For full details see the [AWS CDK Explorer](https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/cdk-explorer.html) in the user guide. - -{ [Return to Top](#top) } - -## Amazon CodeWhisperer - -**Amazon CodeWhisperer** provides inline code suggestions using machine learning and natural language processing on the contents of your current file. Supported languages include: Java, Python and Javascript. - -Once enabled, CodeWhisperer will provide code suggestions automatically and can also be requested manually using option+c (mac) / alt+c (PC). To accept a suggestion and add it to your file, press Tab, Enter or click on it. To dismiss a suggestion, press escape or keep typing. - -For more information, see [Amazon CodeWhisperer](https://aws.amazon.com/codewhisperer) in our user guide. - -## { [Return to Top](#top) } - -## AWS Serverless Applications - -The AWS Toolkit enables you to develop [AWS serverless applications](https://aws.amazon.com/serverless/) locally. It also provides _Inline Actions_ in Cloud9 to do the following: - -- Use SAM (serverless application model) templates to build and debug your locally developed AWS serverless applications. -- Run selected [AWS Lambda](https://aws.amazon.com/lambda/) functions. - -To start debugging with a SAM template, click the `Add Debug Configuration` _Inline Action_ in the template file. - -![Add Debug Configuration Template](./resources/marketplace/cloud9/Codelens-YAML-template.png) - -###### The _Inline Action_ indicator in the SAM template allows you to add a debug configuration for the serverless application. - -Alternatively, you can run and debug just the AWS Lambda function and exclude other resources defined by the SAM template. Again, use an _Inline Action_ indicator for an AWS Lambda-function handler. (A _handler_ is a function that Lambda calls to start execution of a Lambda function.) - -![Add Debug Configuration Direct](./resources/marketplace/cloud9/Codelens-direct-function.png) - -###### The _Inline Action_ indicator in the application file lets you add a debug configuration for a selected AWS Lambda function. - -When you run a debug session, the status and results are shown in the **AWS Toolkit** output channel. If the toolkit does not have an open **AWS Toolkit** output channel, one can be created with the New Tab button. - -![Configure and Run](./resources/marketplace/cloud9/sam-configure-and-run-still-en.png) - -###### After a local run is complete, the output appears in the **OUTPUT** tab. - -When you're satisfied with performance, you can [deploy your serverless application](https://docs.aws.amazon.com/cloud9/latest/user-guide/deploy-serverless-app.html). The SAM template is converted to a CloudFormation template, which is then used to deploy all the application's assets to the AWS Cloud. - -### Supported runtimes - -The Toolkit _local SAM debugging_ feature supports these runtimes: - -- JavaScript (Node.js 16.x, Node.js 18.x, Node.js 20.x, Node.js 22.x,) -- Python (3.8, 3.9, 3.10, 3.11, 3.12, 3.13) - -For more information see [Working with AWS Serverless Applications](https://docs.aws.amazon.com/cloud9/latest/user-guide/serverless-apps-toolkit.html) in the user guide. - -{ [Return to Top](#top) } - ---- - -## `AWS:` Commands - -The Toolkit provides commands (prefixed with `AWS:`) to the AWS Cloud9 _Go to Anything panel_, available by clicking the search bar and typing "." or via hotkey. - -| OS | Hotkey | -| :------ | :------- | -| Windows | `CTRL-.` | -| macOS | `CMD-.` | - -![Go to Anything panel](./resources/marketplace/cloud9/open-commands-en.png) - -| AWS Command | Description | -| :---------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `AWS: About Toolkit` | Displays information about the AWS Toolkit. | -| `AWS: Add Local Invoke and Debug Configuration` | Creates an `aws-sam` Debug Configuration from a function in the given source file | -| `AWS: Connect to AWS` | Select or create a connection to AWS. | -| `AWS: Create a new Issue on Github` | Opens the AWS Toolkit's [New Issue page on Github](https://github.com/aws/aws-toolkit-vscode/issues/new/choose). | -| `AWS: Create Credentials Profile` | Creates an AWS credentials profile. | -| `AWS: Create Lambda SAM Application` | Generates code files for a new AWS serverless Lambda application. For more information, see [Creating a Serverless Application](https://docs.aws.amazon.com/cloud9/latest/user-guide/latest/user-guide/create-sam.html) in the user guide. | -| `AWS: Create new CloudFormation Template` | Creates a new starter Cloudformation Template | -| `AWS: Create new SAM Template` | Creates a new starter SAM Template | -| `AWS: Deploy SAM Application` | Deploys a local serverless application to an AWS account. For more information, see [Deploying a Serverless Application](https://docs.aws.amazon.com/cloud9/latest/user-guide/deploy-serverless-app.html) in the user guide. | -| `AWS: Edit Credentials` | Opens the `~/.aws/credentials` or `~/.aws/config` file for editing. | -| `AWS: Local Invoke and Debug Configuration` | Shows a tool that helps you create, edit, run, and debug a SAM _launch config_ (`type:aws-sam`). | -| `AWS: Detect SAM CLI` | Checks whether the Toolkit can communicate correctly with the AWS SAM CLI that is installed. | -| `AWS: Show or Hide Regions` | Adds or removes AWS Regions in the **AWS Explorer**. | -| `AWS: Sign out` | Disconnect the Toolkit from the current AWS connection. | -| `AWS: Submit Quick Feedback...` | Submit a private, one-way message and sentiment to the AWS Toolkit dev team. For larger issues that warrant conversations or bugfixes, please submit an issue in Github with the **AWS: Create a New Issue on Github** command. | -| `AWS: Toggle SAM hints in source files` | Toggles AWS SAM-related Inline Actions in source files | -| `AWS: View Toolkit Logs` | Displays log files that contain general Toolkit diagnostic information. | -| `AWS: View Quick Start` | Open this quick-start guide. | -| `AWS: View Toolkit Documentation` | Opens the [user guide](https://docs.aws.amazon.com/cloud9/latest/user-guide/toolkit-welcome.html) for the Toolkit. | -| `AWS: View Source on GitHub` | Opens the [GitHub repository](https://github.com/aws/aws-toolkit-vscode) for the Toolkit. | - -{ [Return to Top](#top) } - ---- - -# Get help - -For additional details on how to use the AWS Toolkit, see the [user guide](https://docs.aws.amazon.com/cloud9/latest/user-guide/toolkit-welcome.html). - -To report issues with the Toolkit or to propose Toolkit code changes, see the [aws/aws-toolkit-vscode](https://github.com/aws/aws-toolkit-vscode) repository on GitHub. - -You can also [contact AWS](https://aws.amazon.com/contact-us/) directly. - -{ [Return to Top](#top) } diff --git a/scripts/generateIcons.ts b/scripts/generateIcons.ts index d920cb67f9f..e3f2d42da42 100644 --- a/scripts/generateIcons.ts +++ b/scripts/generateIcons.ts @@ -18,7 +18,7 @@ const iconSources = [ // Paths relative to packages/toolkit `resources/icons/**/*.svg`, `../../node_modules/@vscode/codicons/src/icons/**/*.svg`, - '!**/{cloud9,dark,light}/**', + '!**/{dark,light}/**', ] interface PackageIcon { @@ -73,27 +73,6 @@ async function updatePackage(fontPath: string, icons: [id: string, icon: Package console.log('Updated package.json') } -const themes = { - dark: '#C5C5C5', - light: '#424242', -} - -async function generateCloud9Icons(targets: { name: string; path: string }[], destination: string): Promise { - console.log('Generating icons for Cloud9') - - function replaceColor(file: string, color: string, dst: string): void { - const contents = nodefs.readFileSync(file, 'utf-8') - const replaced = contents.replace(/currentColor/g, color) - nodefs.writeFileSync(dst, replaced) - } - - for (const [theme, color] of Object.entries(themes)) { - const themeDest = path.join(destination, theme) - nodefs.mkdirSync(themeDest, { recursive: true }) - await Promise.all(targets.map((t) => replaceColor(t.path, color, path.join(themeDest, `${t.name}.svg`)))) - } -} - async function generate(mappings: Record = {}) { const dest = path.join(fontsDir, `${fontId}.woff`) const relativeDest = path.relative(projectDir, dest) @@ -166,7 +145,6 @@ ${result.template} `.trim() const stylesheetPath = path.join(stylesheetsDir, 'icons.css') - const cloud9Dest = path.join(iconsDir, 'cloud9', 'generated') const isValidIcon = (i: (typeof icons)[number]): i is Required => i.data !== undefined nodefs.mkdirSync(fontsDir, { recursive: true }) @@ -178,11 +156,9 @@ ${result.template} `./${relativeDest}`, icons.filter(isValidIcon).map((i) => [i.name, i.data]) ) - await generateCloud9Icons(icons, cloud9Dest) generated.addEntry(dest) generated.addEntry(stylesheetPath) - generated.addEntry(cloud9Dest) generated.emit(path.join(projectDir, 'dist')) } diff --git a/scripts/generateNonCodeFiles.ts b/scripts/generateNonCodeFiles.ts index 059ded8cbde..c165e9e6b36 100644 --- a/scripts/generateNonCodeFiles.ts +++ b/scripts/generateNonCodeFiles.ts @@ -63,8 +63,6 @@ function generateFileHash(root: string) { try { translateReadmeToHtml(projectRoot, 'README.md', 'quickStartVscode.html', true) - translateReadmeToHtml(projectRoot, 'README.quickstart.cloud9.md', 'quickStartCloud9.html', false) - translateReadmeToHtml(projectRoot, 'README.quickstart.cloud9.md', 'quickStartCloud9-cn.html', false, true) generateFileHash(projectRoot) } catch (error) { console.error(error) From 3ef40113ab598c0508bdda60ba81c28a5030c709 Mon Sep 17 00:00:00 2001 From: Maxim Hayes <149123719+hayemaxi@users.noreply.github.com> Date: Thu, 16 Jan 2025 16:23:51 -0500 Subject: [PATCH 2/2] Update packages/toolkit/.changes/next-release/Removal-3ef48be0-d3f3-4252-be69-9a0684406944.json Co-authored-by: Justin M. Keyes --- .../test/shared/extensionUtilities.test.ts | 53 +------------------ ...-3ef48be0-d3f3-4252-be69-9a0684406944.json | 2 +- 2 files changed, 2 insertions(+), 53 deletions(-) diff --git a/packages/core/src/test/shared/extensionUtilities.test.ts b/packages/core/src/test/shared/extensionUtilities.test.ts index 0e29c9f7f06..0fc846f54ab 100644 --- a/packages/core/src/test/shared/extensionUtilities.test.ts +++ b/packages/core/src/test/shared/extensionUtilities.test.ts @@ -6,20 +6,16 @@ import assert from 'assert' import { AWSError } from 'aws-sdk' -import * as path from 'path' import * as sinon from 'sinon' import { DefaultEc2MetadataClient } from '../../shared/clients/ec2MetadataClient' import * as vscode from 'vscode' import { UserActivity, getComputeRegion, initializeComputeRegion } from '../../shared/extensionUtilities' import { isDifferentVersion, setMostRecentVersion } from '../../shared/extensionUtilities' -import * as filesystemUtilities from '../../shared/filesystemUtilities' -import { FakeExtensionContext } from '../fakeExtensionContext' import { InstanceIdentity } from '../../shared/clients/ec2MetadataClient' import { extensionVersion } from '../../shared/vscode/env' import { sleep } from '../../shared/utilities/timeoutUtils' import globals from '../../shared/extensionGlobals' -import { createQuickStartWebview, maybeShowMinVscodeWarning } from '../../shared/extensionStartup' -import { fs } from '../../shared' +import { maybeShowMinVscodeWarning } from '../../shared/extensionStartup' import { getTestWindow } from './vscode/window' import { assertTelemetry } from '../testUtil' @@ -34,53 +30,6 @@ describe('extensionUtilities', function () { assertTelemetry('toolkit_showNotification', []) }) - describe('createQuickStartWebview', async function () { - let context: FakeExtensionContext - let tempDir: string | undefined - - beforeEach(async function () { - context = await FakeExtensionContext.create() - tempDir = await filesystemUtilities.makeTemporaryToolkitFolder() - context.extensionPath = tempDir - }) - - afterEach(async function () { - if (tempDir) { - await fs.delete(tempDir, { recursive: true }) - } - }) - - it("throws error if a quick start page doesn't exist", async () => { - await assert.rejects(createQuickStartWebview(context, 'irresponsibly-named-file')) - }) - - it('returns a webview with unaltered text if a valid file is passed without tokens', async function () { - const filetext = 'this temp page does not have any tokens' - const filepath = 'tokenless' - await fs.writeFile(path.join(context.extensionPath, filepath), filetext) - const webview = await createQuickStartWebview(context, filepath) - - assert.strictEqual(typeof webview, 'object') - const forcedWebview = webview as vscode.WebviewPanel - assert.strictEqual(forcedWebview.webview.html.includes(filetext), true) - }) - - it('returns a webview with tokens replaced', async function () { - const token = '!!EXTENSIONROOT!!' - const basetext = 'this temp page has tokens: ' - const filetext = basetext + token - const filepath = 'tokenless' - await fs.writeFile(path.join(context.extensionPath, filepath), filetext) - const webview = await createQuickStartWebview(context, filepath) - - assert.strictEqual(typeof webview, 'object') - const forcedWebview = webview as vscode.WebviewPanel - - const pathAsVsCodeResource = forcedWebview.webview.asWebviewUri(vscode.Uri.file(context.extensionPath)) - assert.strictEqual(forcedWebview.webview.html.includes(`${basetext}${pathAsVsCodeResource}`), true) - }) - }) - describe('isDifferentVersion', function () { it('returns false if the version exists and matches the existing version exactly', async function () { const goodVersion = '1.2.3' diff --git a/packages/toolkit/.changes/next-release/Removal-3ef48be0-d3f3-4252-be69-9a0684406944.json b/packages/toolkit/.changes/next-release/Removal-3ef48be0-d3f3-4252-be69-9a0684406944.json index c8d7692200c..a95e1b887a5 100644 --- a/packages/toolkit/.changes/next-release/Removal-3ef48be0-d3f3-4252-be69-9a0684406944.json +++ b/packages/toolkit/.changes/next-release/Removal-3ef48be0-d3f3-4252-be69-9a0684406944.json @@ -1,4 +1,4 @@ { "type": "Removal", - "description": "Cloud9: Remove all support and compatibility." + "description": "Cloud9: remove special-case logic." }