@@ -95,6 +95,7 @@ import { decryptResponse, encryptRequest } from '../encryption'
9595import { getCursorState } from '../utils'
9696import { focusAmazonQPanel } from './commands'
9797import { ChatMessage } from '@aws/language-server-runtimes/server-interface'
98+ import { CommentUtils } from 'aws-core-vscode/utils'
9899
99100export function registerActiveEditorChangeListener ( languageClient : LanguageClient ) {
100101 let debounceTimer : NodeJS . Timeout | undefined
@@ -701,7 +702,7 @@ async function handleCompleteResult<T extends ChatResult>(
701702) {
702703 const decryptedMessage = await decryptResponse < T > ( result , encryptionKey )
703704
704- handleSecurityFindings ( decryptedMessage , languageClient )
705+ await handleSecurityFindings ( decryptedMessage , languageClient )
705706
706707 void provider . webview ?. postMessage ( {
707708 command : chatRequestType . method ,
@@ -716,10 +717,10 @@ async function handleCompleteResult<T extends ChatResult>(
716717 disposable . dispose ( )
717718}
718719
719- function handleSecurityFindings (
720+ async function handleSecurityFindings (
720721 decryptedMessage : { additionalMessages ?: ChatMessage [ ] } ,
721722 languageClient : LanguageClient
722- ) : void {
723+ ) : Promise < void > {
723724 if ( decryptedMessage . additionalMessages === undefined || decryptedMessage . additionalMessages . length === 0 ) {
724725 return
725726 }
@@ -730,10 +731,18 @@ function handleSecurityFindings(
730731 try {
731732 const aggregatedCodeScanIssues : AggregatedCodeScanIssue [ ] = JSON . parse ( message . body )
732733 for ( const aggregatedCodeScanIssue of aggregatedCodeScanIssues ) {
734+ const document = await vscode . workspace . openTextDocument ( aggregatedCodeScanIssue . filePath )
733735 for ( const issue of aggregatedCodeScanIssue . issues ) {
734- issue . visible = ! CodeWhispererSettings . instance
736+ const isIssueTitleIgnored = CodeWhispererSettings . instance
735737 . getIgnoredSecurityIssues ( )
736738 . includes ( issue . title )
739+ const isSingleIssueIgnored = CommentUtils . detectCommentAboveLine (
740+ document ,
741+ issue . startLine ,
742+ CodeWhispererConstants . amazonqIgnoreNextLine
743+ )
744+
745+ issue . visible = ! isIssueTitleIgnored && ! isSingleIssueIgnored
737746 }
738747 }
739748 initSecurityScanRender ( aggregatedCodeScanIssues , undefined , CodeAnalysisScope . PROJECT )
0 commit comments