Skip to content

Commit 1ae9789

Browse files
Merge master into feature/agentic-chat
2 parents b5cd5c3 + dd14b98 commit 1ae9789

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "Code fix line number or file is sometimes not accurate"
4+
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { TelemetryHelper } from '../util/telemetryHelper'
2020
import { tempDirPath } from '../../shared/filesystemUtilities'
2121
import { CodeWhispererSettings } from '../util/codewhispererSettings'
2222
import { AuthUtil } from '../util/authUtil'
23+
import { saveDocumentIfDirty } from '../../shared/utilities/textDocumentUtilities'
2324

2425
export async function startCodeFixGeneration(
2526
client: DefaultCodeWhispererClient,
@@ -44,6 +45,9 @@ export async function startCodeFixGeneration(
4445
* Step 1: Generate zip
4546
*/
4647
throwIfCancelled()
48+
49+
// Save the file if it has unsaved changes to ensure the latest content is included in the zip
50+
await saveDocumentIfDirty(filePath)
4751
const admZip = new AdmZip()
4852
admZip.addLocalFile(filePath)
4953

packages/core/src/codewhisperer/service/securityIssueProvider.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,11 @@ export class SecurityIssueProvider {
4848
.filter((issue) => {
4949
const range = new vscode.Range(
5050
issue.startLine,
51-
event.document.lineAt(issue.startLine)?.range.start.character ?? 0,
52-
issue.endLine,
53-
event.document.lineAt(issue.endLine - 1)?.range.end.character ?? 0
51+
0,
52+
issue.startLine === issue.endLine ? issue.endLine + 1 : issue.endLine,
53+
0
5454
)
55+
5556
const intersection = changedRange.intersection(range)
5657
return !(intersection && (/\S/.test(changedText) || changedText === ''))
5758
})

0 commit comments

Comments
 (0)