Skip to content

Commit fb2e795

Browse files
authored
Merge branch 'master' into ui-fixes
2 parents ff4086c + c9d6f91 commit fb2e795

File tree

21 files changed

+635
-38
lines changed

21 files changed

+635
-38
lines changed

package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/amazonq/package.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -852,15 +852,21 @@
852852
},
853853
{
854854
"command": "aws.amazonq.inline.acceptEdit",
855-
"title": "%aws.amazonq.inline.acceptEdit%"
855+
"title": "%AWS.amazonq.inline.acceptEdit%",
856+
"category": "%AWS.amazonq.title%",
857+
"enablement": "aws.codewhisperer.connected"
856858
},
857859
{
858860
"command": "aws.amazonq.inline.rejectEdit",
859-
"title": "%aws.amazonq.inline.rejectEdit%"
861+
"title": "%AWS.amazonq.inline.rejectEdit%",
862+
"category": "%AWS.amazonq.title%",
863+
"enablement": "aws.codewhisperer.connected"
860864
},
861865
{
862866
"command": "aws.amazonq.toggleNextEditPredictionPanel",
863-
"title": "%aws.amazonq.toggleNextEditPredictionPanel%"
867+
"title": "%AWS.amazonq.toggleNextEditPredictionPanel%",
868+
"category": "%AWS.amazonq.title%",
869+
"enablement": "aws.codewhisperer.connected"
864870
}
865871
],
866872
"keybindings": [

packages/amazonq/src/app/inline/recommendationService.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
import { TelemetryHelper } from './telemetryHelper'
2222
import { ICursorUpdateRecorder } from './cursorUpdateManager'
2323
import { getLogger } from 'aws-core-vscode/shared'
24+
import { getOpenFilesInWindow } from 'aws-core-vscode/utils'
2425
import { asyncCallWithTimeout } from '../../util/timeoutUtil'
2526

2627
export interface GetAllRecommendationsOptions {
@@ -79,14 +80,15 @@ export class RecommendationService {
7980
contentChanges: documentChangeEvent.contentChanges.map((x) => x as TextDocumentContentChangeEvent),
8081
}
8182
: undefined
82-
83+
const openTabs = await getOpenFilesInWindow()
8384
let request: InlineCompletionWithReferencesParams = {
8485
textDocument: {
8586
uri: document.uri.toString(),
8687
},
8788
position,
8889
context,
8990
documentChangeParams: documentChangeParams,
91+
openTabFilepaths: openTabs,
9092
}
9193
if (options.editsStreakToken) {
9294
request = { ...request, partialResultToken: options.editsStreakToken }

packages/amazonq/src/lsp/chat/messages.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,11 @@ async function handlePartialResult<T extends ChatResult>(
732732
// This is to filter out the message containing findings from CodeReview tool to update CodeIssues panel
733733
decryptedMessage.additionalMessages = decryptedMessage.additionalMessages?.filter(
734734
(message) =>
735-
!(message.messageId !== undefined && message.messageId.endsWith(CodeWhispererConstants.findingsSuffix))
735+
!(
736+
message.messageId !== undefined &&
737+
(message.messageId.endsWith(CodeWhispererConstants.codeReviewFindingsSuffix) ||
738+
message.messageId.endsWith(CodeWhispererConstants.displayFindingsSuffix))
739+
)
736740
)
737741

738742
if (decryptedMessage.body !== undefined) {
@@ -784,7 +788,11 @@ async function handleSecurityFindings(
784788
}
785789
for (let i = decryptedMessage.additionalMessages.length - 1; i >= 0; i--) {
786790
const message = decryptedMessage.additionalMessages[i]
787-
if (message.messageId !== undefined && message.messageId.endsWith(CodeWhispererConstants.findingsSuffix)) {
791+
if (
792+
message.messageId !== undefined &&
793+
(message.messageId.endsWith(CodeWhispererConstants.codeReviewFindingsSuffix) ||
794+
message.messageId.endsWith(CodeWhispererConstants.displayFindingsSuffix))
795+
) {
788796
if (message.body !== undefined) {
789797
try {
790798
const aggregatedCodeScanIssues: AggregatedCodeScanIssue[] = JSON.parse(message.body)
@@ -803,7 +811,12 @@ async function handleSecurityFindings(
803811
issue.visible = !isIssueTitleIgnored && !isSingleIssueIgnored
804812
}
805813
}
806-
initSecurityScanRender(aggregatedCodeScanIssues, undefined, CodeAnalysisScope.PROJECT)
814+
initSecurityScanRender(
815+
aggregatedCodeScanIssues,
816+
undefined,
817+
CodeAnalysisScope.AGENTIC,
818+
message.messageId.endsWith(CodeWhispererConstants.codeReviewFindingsSuffix)
819+
)
807820
SecurityIssueTreeViewProvider.focus()
808821
} catch (e) {
809822
languageClient.info('Failed to parse findings')

packages/amazonq/src/lsp/client.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
import vscode, { env, version } from 'vscode'
6+
import vscode, { version } from 'vscode'
77
import * as nls from 'vscode-nls'
88
import { LanguageClient, LanguageClientOptions, RequestType, State } from 'vscode-languageclient'
99
import { InlineCompletionManager } from '../app/inline/completion'
@@ -38,6 +38,7 @@ import {
3838
getOptOutPreference,
3939
isAmazonLinux2,
4040
getClientId,
41+
getClientName,
4142
extensionVersion,
4243
isSageMaker,
4344
DevSettings,
@@ -163,7 +164,7 @@ export async function startLanguageServer(
163164
initializationOptions: {
164165
aws: {
165166
clientInfo: {
166-
name: env.appName,
167+
name: getClientName(),
167168
version: version,
168169
extension: {
169170
name: 'AmazonQ-For-VSCode',
@@ -182,6 +183,8 @@ export async function startLanguageServer(
182183
modelSelection: true,
183184
workspaceFilePath: vscode.workspace.workspaceFile?.fsPath,
184185
codeReviewInChat: codeReviewInChat,
186+
// feature flag for displaying findings found not through CodeReview in the Code Issues Panel
187+
displayFindings: true,
185188
},
186189
window: {
187190
notifications: true,

packages/amazonq/test/unit/amazonq/apps/inline/recommendationService.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ describe('RecommendationService', () => {
147147
position: mockPosition,
148148
context: mockContext,
149149
documentChangeParams: undefined,
150+
openTabFilepaths: [],
150151
})
151152

152153
// Verify session management
@@ -189,6 +190,7 @@ describe('RecommendationService', () => {
189190
position: mockPosition,
190191
context: mockContext,
191192
documentChangeParams: undefined,
193+
openTabFilepaths: [],
192194
}
193195
const secondRequestArgs = sendRequestStub.secondCall.args[1]
194196
assert.deepStrictEqual(firstRequestArgs, expectedRequestArgs)

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@
471471
"@aws-sdk/types": "^3.13.1",
472472
"@aws/chat-client": "^0.1.4",
473473
"@aws/chat-client-ui-types": "^0.1.47",
474-
"@aws/language-server-runtimes": "^0.2.111",
474+
"@aws/language-server-runtimes": "^0.2.119",
475475
"@aws/language-server-runtimes-types": "^0.1.47",
476476
"@cspotcode/source-map-support": "^0.8.1",
477477
"@sinonjs/fake-timers": "^10.0.2",

packages/core/package.nls.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@
358358
"AWS.amazonq.codewhisperer.title": "Amazon Q",
359359
"AWS.amazonq.toggleCodeSuggestion": "Toggle Auto-Suggestions",
360360
"AWS.amazonq.toggleCodeScan": "Toggle Auto-Scans",
361+
"AWS.amazonq.toggleNextEditPredictionPanel": "Toggle next edit suggestion",
361362
"AWS.amazonq.scans.scanProgress": "Sure. This may take a few minutes. I will send a notification when it’s complete if you navigate away from this panel.",
362363
"AWS.amazonq.scans.waitingForInput": "Waiting on your inputs...",
363364
"AWS.amazonq.scans.chooseScan.description": "Would you like to review your active file or the workspace you have open?",
@@ -465,6 +466,8 @@
465466
"AWS.amazonq.doc.pillText.reject": "Reject",
466467
"AWS.amazonq.doc.pillText.makeChanges": "Make changes",
467468
"AWS.amazonq.inline.invokeChat": "Inline chat",
469+
"AWS.amazonq.inline.acceptEdit": "Accept edit suggestion",
470+
"AWS.amazonq.inline.rejectEdit": "Reject edit suggestion",
468471
"AWS.amazonq.opensettings:": "Open settings",
469472
"AWS.toolkit.lambda.walkthrough.quickpickTitle": "Application Builder Walkthrough",
470473
"AWS.toolkit.lambda.walkthrough.title": "Get started building your application",

packages/core/src/codewhisperer/commands/startSecurityScan.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ export async function startSecurityScan(
108108
zipUtil: ZipUtil = new ZipUtil(),
109109
scanUuid?: string
110110
) {
111+
if (scope === CodeAnalysisScope.AGENTIC) {
112+
throw new CreateCodeScanFailedError('Cannot use Agentic scope')
113+
}
111114
const profile = AuthUtil.instance.regionProfileManager.activeRegionProfile
112115
const logger = getLoggerForScope(scope)
113116
/**

packages/core/src/codewhisperer/models/constants.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,7 @@ export enum CodeAnalysisScope {
841841
FILE_AUTO = 'FILE_AUTO',
842842
FILE_ON_DEMAND = 'FILE_ON_DEMAND',
843843
PROJECT = 'PROJECT',
844+
AGENTIC = 'AGENTIC',
844845
}
845846

846847
export enum TestGenerationJobStatus {
@@ -907,4 +908,7 @@ export const predictionTrackerDefaultConfig = {
907908
maxSupplementalContext: 15,
908909
}
909910

910-
export const findingsSuffix = '_codeReviewFindings'
911+
export const codeReviewFindingsSuffix = '_codeReviewFindings'
912+
export const displayFindingsSuffix = '_displayFindings'
913+
914+
export const displayFindingsDetectorName = 'DisplayFindings'

0 commit comments

Comments
 (0)