Skip to content

Commit

Permalink
Merge pull request aws#5177 from hayemaxi/feature/separate-sessions
Browse files Browse the repository at this point in the history
 Merge master into feature/separate-sessions
  • Loading branch information
hayemaxi authored Jun 17, 2024
2 parents ef74cea + 49fde2a commit 659e292
Show file tree
Hide file tree
Showing 154 changed files with 2,050 additions and 993 deletions.
11 changes: 11 additions & 0 deletions docs/web.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ do the following:

Now when you run the extension in the browser it will do CORS checks.

## Running in [vscode.dev](https://vscode.dev)

The following will explain how to get your latest local development changes running in the actual `vscode.dev`. Use this if you want to test on an actual VS Code Web instance.

1. Build the extension. We need the Web mode entrypoint file to exist.
2. OPTIONAL: Start up your browser with security disabled. Certain functionalities do not support CORS and will fail otherwise.
- On MacOS from the CLI is similar to `/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --disable-web-security`
3. `cd` to the extension you want to test in `packages/`. Eg: `packages/amazonq/`.
- We need to do this since the following command hosts your build from the `cwd`.
4. Follow the [VS Code documentation](https://code.visualstudio.com/api/extension-guides/web-extensions#test-your-web-extension-in-vscode.dev) for setting up certs, serving your the latest changes, and installing the extension to `vscode.dev`.

## Testing in VSCode Web Mode

The following steps will result in a VSCode Extension window running
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions packages/amazonq/.changes/1.9.0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"date": "2024-06-14",
"version": "1.9.0",
"entries": [
{
"type": "Bug Fix",
"description": "Amazon Q inline suggestions: remember `Pause Auto-Suggestions` after IDE restart"
},
{
"type": "Bug Fix",
"description": "Amazon Q /dev command: stop showing spinner when there is an error."
},
{
"type": "Bug Fix",
"description": "Security Scan: Fixes an issue where auto-scans cause the editor to become unresponsive for larger projects."
},
{
"type": "Bug Fix",
"description": "Fix(Amazon Q Code Transformation): show more detailed error messages for proxy issues"
},
{
"type": "Feature",
"description": "Amazon Q Code Transform: Allow user to view transformation build log"
}
]
}

This file was deleted.

37 changes: 37 additions & 0 deletions packages/amazonq/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,43 @@
"preLaunchTask": "webRun",
"postDebugTask": "webRunTerminate"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--disable-extensions",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/dist/test/unit/index",
"${workspaceFolder}/../core/dist/src/testFixtures/workspaceFolder"
],
"env": {
"DEVELOPMENT_PATH": "${workspaceFolder}",
"AWS_TOOLKIT_AUTOMATION": "local"
},
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"preLaunchTask": "watch"
},
{
"name": "Extension Tests (current file)",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--disable-extensions",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/dist/test/unit/index",
"${workspaceFolder}/../core/dist/src/testFixtures/workspaceFolder"
],
"env": {
"TEST_FILE": "${relativeFile}",
"DEVELOPMENT_PATH": "${workspaceFolder}",
"AWS_TOOLKIT_AUTOMATION": "local"
},
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"preLaunchTask": "watch"
},
{
"name": "E2E Test (current file)",
"type": "extensionHost",
Expand Down
8 changes: 8 additions & 0 deletions packages/amazonq/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 1.9.0 2024-06-14

- **Bug Fix** Amazon Q inline suggestions: remember `Pause Auto-Suggestions` after IDE restart
- **Bug Fix** Amazon Q /dev command: stop showing spinner when there is an error.
- **Bug Fix** Security Scan: Fixes an issue where auto-scans cause the editor to become unresponsive for larger projects.
- **Bug Fix** Fix(Amazon Q Code Transformation): show more detailed error messages for proxy issues
- **Feature** Amazon Q Code Transform: Allow user to view transformation build log

## 1.8.0 2024-06-07

- **Bug Fix** fix(featureDev): fix file rejection for multi-workspaces
Expand Down
29 changes: 18 additions & 11 deletions packages/amazonq/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "amazon-q-vscode",
"displayName": "Amazon Q",
"description": "Amazon Q is your generative AI-powered assistant across the software development lifecycle.",
"version": "1.9.0-SNAPSHOT",
"version": "1.10.0-SNAPSHOT",
"extensionKind": [
"workspace"
],
Expand Down Expand Up @@ -59,6 +59,7 @@
"lint": "echo 'Nothing to lint yet!'",
"watch": "npm run clean && npm run buildScripts && tsc -watch -p ./",
"testCompile": "npm run clean && npm run buildScripts && npm run compileOnly",
"test": "npm run testCompile && c8 ts-node ../core/scripts/test/test.ts dist/test/unit/index.js ../core/dist/src/testFixtures/workspaceFolder",
"testE2E": "npm run testCompile && c8 ts-node ../core/scripts/test/testE2E.ts dist/test/e2e/index.js",
"webRun": "npx @vscode/test-web --open-devtools --browserOption=--disable-web-security --waitForDebugger=9222 --extensionDevelopmentPath=. .",
"webWatch": "npm run clean && npm run buildScripts && webpack --mode development --watch",
Expand Down Expand Up @@ -685,6 +686,17 @@
"title": "Meet Amazon Q",
"description": "Your generative AI-powered assistant across the software development lifecycle.",
"steps": [
{
"id": "aws.amazonq.walkthrough.inlineSuggestions",
"title": "Get inline code suggestions",
"description": "Amazon Q suggests code as you type based on your open files. Accepted suggestions from licensed code will go into the Code Reference Log.\n\n[Try Example](command:_aws.amazonq.walkthrough.inlineSuggestionsExample)\n\n**TIP: Invoke manually with opt/alt + c**",
"media": {
"markdown": "./resources/walkthrough/amazonq/inline.md"
},
"completionEvents": [
"onCommand:_aws.amazonq.walkthrough.inlineSuggestionsExample"
]
},
{
"id": "aws.amazonq.walkthrough.chat",
"title": "Ask using chat",
Expand All @@ -694,21 +706,16 @@
},
"completionEvents": []
},
{
"id": "aws.amazonq.walkthrough.inlineSuggestions",
"title": "Get inline code suggestions",
"description": "Amazon Q suggests code as you type based on your open files. Accepted suggestions from licensed code will go into the Code Reference Log.\n\n[Try inline code examples](command:aws.amazonq.gettingStarted)\n\n**TIP: Invoke manually with opt/alt + c**",
"media": {
"markdown": "./resources/walkthrough/amazonq/inline.md"
}
},
{
"id": "aws.amazonq.walkthrough.securityScan",
"title": "Check for security vulnerabilities",
"description": "Amazon Q scans your code to identify security vulnerabilities and suggests fixes.\n\nStart a scan from the status bar menu.\n\n**TIP: identifies vulnerabilities in Python, Typescript, Ruby, AWS CDK, and more**",
"description": "Amazon Q scans your code to identify security vulnerabilities and suggests fixes.\n\nStart a scan from the status bar menu.\n\n[Scan your current project](command:_aws.amazonq.walkthrough.securityScanExample)\n\nIdentifies vulnerabilities in Python, Typescript, Ruby, AWS CDK, and [more](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/q-language-ide-support.html#security-scans-language-support)",
"media": {
"markdown": "./resources/walkthrough/amazonq/scans.md"
}
},
"completionEvents": [
"onCommand:_aws.amazonq.walkthrough.securityScanExample"
]
},
{
"id": "aws.amazonq.walkthrough.settings",
Expand Down
1 change: 1 addition & 0 deletions packages/amazonq/scripts/build/copyFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const tasks: CopyTask[] = [

{ target: path.join('../core', 'resources'), destination: path.join('..', 'resources') },
{ target: path.join('../core', 'package.nls.json'), destination: path.join('..', 'package.nls.json') },
{ target: 'test/unit/amazonqGumby/resources' },

// Vue
{
Expand Down
2 changes: 1 addition & 1 deletion packages/amazonq/src/extensionCommon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { initializeAuth, CredentialsStore, LoginManager, AuthUtils, SsoConnectio
import { CommonAuthWebview } from 'aws-core-vscode/login'
import { VSCODE_EXTENSION_ID } from 'aws-core-vscode/utils'
import { telemetry, ExtStartUpSources } from 'aws-core-vscode/telemetry'
import { makeEndpointsProvider, registerGenericCommands } from 'aws-core-vscode/common'
import { makeEndpointsProvider, registerGenericCommands } from 'aws-core-vscode/extensionCommon'
import { registerCommands } from './commands'

export const amazonQContextPrefix = 'amazonq'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
*/

import { EventEmitter } from 'vscode'
import { DefaultAmazonQAppInitContext } from '../../../amazonq/apps/initContext'
import { MessagePublisher } from '../../../amazonq/messages/messagePublisher'
import { DefaultAmazonQAppInitContext, MessagePublisher } from 'aws-core-vscode/amazonq'
import assert from 'assert'

describe('DefaultAmazonQAppInitContext', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
*/

import sinon from 'sinon'
import { AuthController } from '../../../amazonq/auth/controller'
import { reconnect } from '../../../codewhisperer/commands/basicCommands'
import { AuthController } from 'aws-core-vscode/amazonq'
import { reconnect, amazonQChatSource } from 'aws-core-vscode/codewhisperer'
import assert from 'assert'
import { placeholder } from '../../../shared/vscode/commands2'
import { amazonQChatSource } from '../../../codewhisperer/commands/types'
import { placeholder } from 'aws-core-vscode/shared'

describe('AuthController', () => {
let authController: AuthController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*/

import assert from 'assert'
import { showAmazonQWalkthroughOnce } from '../../../amazonq/onboardingPage/walkthrough'
import { FakeMemento } from '../../fakeExtensionContext'
import { showAmazonQWalkthroughOnce } from 'aws-core-vscode/amazonq'
import { FakeMemento } from 'aws-core-vscode/test'
import sinon from 'sinon'

describe('showAmazonQWalkthroughOnce', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
*/
import * as assert from 'assert'

import { Messenger } from '../../../amazonqFeatureDev/controllers/chat/messenger/messenger'
import { ChatSessionStorage } from '../../../amazonqFeatureDev/storages/chatSession'
import { createMessenger } from '../utils'
import { Messenger, ChatSessionStorage } from 'aws-core-vscode/amazonqFeatureDev'
import { createMessenger } from 'aws-core-vscode/test'

describe('chatSession', () => {
const tabID = '1234'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,11 @@ import {
generateVirtualMemoryUri,
sessionRegisterProvider,
sessionWriteFile,
} from '../utils'
import { CurrentWsFolders } from '../../../amazonqFeatureDev/types'
import { CodeGenState } from '../../../amazonqFeatureDev/session/sessionState'
import { FeatureDevClient } from '../../../amazonqFeatureDev/client/featureDev'
assertTelemetry,
} from 'aws-core-vscode/test'
import { CurrentWsFolders, CodeGenState, FeatureDevClient, Messenger } from 'aws-core-vscode/amazonqFeatureDev'
import path from 'path'
import { assertTelemetry } from '../../testUtil'
import { Messenger } from '../../../amazonqFeatureDev/controllers/chat/messenger/messenger'
import { FileSystemCommon } from '../../../srcShared/fs'
import { FileSystemCommon } from 'aws-core-vscode/srcShared'

describe('session', () => {
const conversationID = '12345'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
*/
import * as vscode from 'vscode'
import assert from 'assert'
import { prepareRepoData } from '../../../amazonqFeatureDev/util/files'
import { createTestWorkspace } from '../../testUtil'
import { TelemetryHelper } from '../../../amazonqFeatureDev/util/telemetryHelper'
import { AmazonqCreateUpload, Metric } from '../../../shared/telemetry/telemetry'
import { ContentLengthError } from '../../../amazonqFeatureDev/errors'
import { maxRepoSizeBytes } from '../../../amazonqFeatureDev/constants'
import {
prepareRepoData,
TelemetryHelper,
ContentLengthError,
maxRepoSizeBytes,
} from 'aws-core-vscode/amazonqFeatureDev'
import { createTestWorkspace } from 'aws-core-vscode/test'
import { AmazonqCreateUpload, Metric } from 'aws-core-vscode/shared'
import sinon from 'sinon'
import { fsCommon } from '../../../srcShared/fs'
import { fsCommon } from 'aws-core-vscode/srcShared'

describe('file utils', () => {
describe('prepareRepoData', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
*/

import * as assert from 'assert'
import DependencyVersions from '../../../../../amazonqGumby/models/dependencies'
import MessengerUtils from '../../../../../amazonqGumby/chat/controller/messenger/messengerUtils'
import { DependencyVersions, MessengerUtils } from 'aws-core-vscode/amazonqGumby'

const TestDependencyVersions = new DependencyVersions('4.2', ['3.8', '4.2', '2.4'], ['1.12', '1.09', '1.10'], '1.3')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import * as vscode from 'vscode'
import assert from 'assert'
import path from 'path'
import { HumanInTheLoopManager } from '../../codewhisperer/service/transformByQ/humanInTheLoopManager'
import { HumanInTheLoopManager } from 'aws-core-vscode/codewhisperer'
import { getTestResourceFilePath, stripStringWhitespace } from './amazonQGumbyUtil'
import { fsCommon } from '../../srcShared/fs'
import { assertEqualPaths } from '../testUtil'
import { fsCommon } from 'aws-core-vscode/srcShared'
import { assertEqualPaths } from 'aws-core-vscode/test'

describe('HumanInTheLoopManager', async function () {
it('will getUserDependencyUpdateDir()', async function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import * as assert from 'assert'
import DependencyVersions from '../../../amazonqGumby/models/dependencies'
import { DependencyVersions } from 'aws-core-vscode/amazonqGumby'

describe('DependencyVersions', () => {
describe('length', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
import { TransformationStep } from '../../../../codewhisperer/client/codewhispereruserclient'
import { TransformationStep } from 'aws-core-vscode/codewhisperer'

export const downloadArtifactIdFixture = 'hil-test-artifact-id'
export const downloadArtifactTypeFixture = 'BuiltJars'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
* SPDX-License-Identifier: Apache-2.0
*/
import assert from 'assert'
import { TransformationProgressUpdate, TransformationStep } from '../../codewhisperer/client/codewhispereruserclient'
import {
TransformationProgressUpdate,
TransformationStep,
findDownloadArtifactStep,
getArtifactsFromProgressUpdate,
} from '../../codewhisperer/service/transformByQ/transformApiHandler'
} from 'aws-core-vscode/codewhisperer'

describe('Amazon Q Transform - transformApiHandler tests', function () {
describe('getArtifactIdentifiers', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import assert from 'assert'
import { parseVersionsListFromPomFile } from '../../codewhisperer/service/transformByQ/transformFileHandler'
import { parseVersionsListFromPomFile } from 'aws-core-vscode/codewhisperer'

describe('Amazon Q Transform - transformFileHandler tests', function () {
describe('parseXmlDependenciesReport', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@ import assert from 'assert'
import sinon from 'sinon'
import fs from 'fs-extra'
import os from 'os'
import {
DiffModel,
AddedChangeNode,
ModifiedChangeNode,
} from '../../codewhisperer/service/transformByQ/transformationResultsViewProvider'
import { DiffModel, AddedChangeNode, ModifiedChangeNode } from 'aws-core-vscode/codewhisperer'
import path from 'path'
import { getTestResourceFilePath } from './amazonQGumbyUtil'

Expand Down
Loading

0 comments on commit 659e292

Please sign in to comment.