Skip to content

Commit e489f68

Browse files
l0minoussamgst-amazonDiler Zazadhasani23David Hasani
authored
Merging Master into feature/stepfunction-execution (#7588)
## Problem Merge conflict: #7549 ## Solution Fixing Merge Conflicts --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license. --------- Co-authored-by: samgst-amazon <[email protected]> Co-authored-by: Diler Zaza <[email protected]> Co-authored-by: David <[email protected]> Co-authored-by: David Hasani <[email protected]> Co-authored-by: Ashish Reddy Podduturi <[email protected]> Co-authored-by: invictus <[email protected]> Co-authored-by: aws-toolkit-automation <> Co-authored-by: Tyrone Smith <[email protected]> Co-authored-by: tsmithsz <[email protected]> Co-authored-by: zelzhou <[email protected]> Co-authored-by: Ralph Flora <[email protected]>
1 parent e941859 commit e489f68

File tree

70 files changed

+4806
-655
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+4806
-655
lines changed

package-lock.json

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

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"@playwright/browser-chromium": "^1.43.1",
4646
"@stylistic/eslint-plugin": "^2.11.0",
4747
"@types/he": "^1.2.3",
48+
"@types/jaro-winkler": "^0.2.4",
4849
"@types/vscode": "^1.68.0",
4950
"@types/vscode-webview": "^1.57.1",
5051
"@types/webpack-env": "^1.18.5",
@@ -74,6 +75,7 @@
7475
},
7576
"dependencies": {
7677
"@types/node": "^22.7.5",
78+
"jaro-winkler": "^0.2.8",
7779
"vscode-nls": "^5.2.0",
7880
"vscode-nls-dev": "^4.0.4"
7981
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"date": "2025-06-25",
3+
"version": "1.79.0",
4+
"entries": [
5+
{
6+
"type": "Bug Fix",
7+
"description": "Added automatic system certificate detection and VSCode proxy settings support"
8+
},
9+
{
10+
"type": "Bug Fix",
11+
"description": "Improved Amazon Linux 2 support with better SageMaker environment detection"
12+
},
13+
{
14+
"type": "Feature",
15+
"description": "/transform: run all builds client-side"
16+
}
17+
]
18+
}

packages/amazonq/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 1.79.0 2025-06-25
2+
3+
- **Bug Fix** Added automatic system certificate detection and VSCode proxy settings support
4+
- **Bug Fix** Improved Amazon Linux 2 support with better SageMaker environment detection
5+
- **Feature** /transform: run all builds client-side
6+
17
## 1.78.0 2025-06-20
28

39
- **Bug Fix** Resolve missing chat options in Amazon Q chat interface.

packages/amazonq/package.json

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "amazon-q-vscode",
33
"displayName": "Amazon Q",
44
"description": "The most capable generative AI-powered assistant for building, operating, and transforming software, with advanced capabilities for managing data and AI",
5-
"version": "1.79.0-SNAPSHOT",
5+
"version": "1.80.0-SNAPSHOT",
66
"extensionKind": [
77
"workspace"
88
],
@@ -828,6 +828,18 @@
828828
"command": "aws.amazonq.clearCache",
829829
"title": "%AWS.amazonq.clearCache%",
830830
"category": "%AWS.amazonq.title%"
831+
},
832+
{
833+
"command": "aws.amazonq.inline.acceptEdit",
834+
"title": "%aws.amazonq.inline.acceptEdit%"
835+
},
836+
{
837+
"command": "aws.amazonq.inline.rejectEdit",
838+
"title": "%aws.amazonq.inline.rejectEdit%"
839+
},
840+
{
841+
"command": "aws.amazonq.toggleNextEditPredictionPanel",
842+
"title": "%aws.amazonq.toggleNextEditPredictionPanel%"
831843
}
832844
],
833845
"keybindings": [
@@ -837,6 +849,18 @@
837849
"mac": "cmd+alt+i",
838850
"linux": "meta+alt+i"
839851
},
852+
{
853+
"command": "aws.amazonq.inline.debugAcceptEdit",
854+
"key": "ctrl+alt+a",
855+
"mac": "cmd+alt+a",
856+
"when": "editorTextFocus"
857+
},
858+
{
859+
"command": "aws.amazonq.inline.debugRejectEdit",
860+
"key": "ctrl+alt+r",
861+
"mac": "cmd+alt+r",
862+
"when": "editorTextFocus"
863+
},
840864
{
841865
"command": "aws.amazonq.explainCode",
842866
"win": "win+alt+e",
@@ -917,6 +941,16 @@
917941
"command": "aws.amazonq.inline.waitForUserDecisionRejectAll",
918942
"key": "escape",
919943
"when": "editorTextFocus && aws.codewhisperer.connected && amazonq.inline.codelensShortcutEnabled"
944+
},
945+
{
946+
"command": "aws.amazonq.inline.acceptEdit",
947+
"key": "tab",
948+
"when": "editorTextFocus && aws.amazonq.editSuggestionActive"
949+
},
950+
{
951+
"command": "aws.amazonq.inline.rejectEdit",
952+
"key": "escape",
953+
"when": "editorTextFocus && aws.amazonq.editSuggestionActive"
920954
}
921955
],
922956
"icons": {
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
/*!
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
// TODO: deprecate this file in favor of core/shared/utils/diffUtils
6+
import { applyPatch } from 'diff'
7+
8+
export type LineDiff =
9+
| { type: 'added'; content: string }
10+
| { type: 'removed'; content: string }
11+
| { type: 'modified'; before: string; after: string }
12+
13+
/**
14+
* Apply a unified diff to original code to generate modified code
15+
* @param originalCode The original code as a string
16+
* @param unifiedDiff The unified diff content
17+
* @returns The modified code after applying the diff
18+
*/
19+
export function applyUnifiedDiff(
20+
docText: string,
21+
unifiedDiff: string
22+
): { appliedCode: string; addedCharacterCount: number; deletedCharacterCount: number } {
23+
try {
24+
const { addedCharacterCount, deletedCharacterCount } = getAddedAndDeletedCharCount(unifiedDiff)
25+
// First try the standard diff package
26+
try {
27+
const result = applyPatch(docText, unifiedDiff)
28+
if (result !== false) {
29+
return {
30+
appliedCode: result,
31+
addedCharacterCount: addedCharacterCount,
32+
deletedCharacterCount: deletedCharacterCount,
33+
}
34+
}
35+
} catch (error) {}
36+
37+
// Parse the unified diff to extract the changes
38+
const diffLines = unifiedDiff.split('\n')
39+
let result = docText
40+
41+
// Find all hunks in the diff
42+
const hunkStarts = diffLines
43+
.map((line, index) => (line.startsWith('@@ ') ? index : -1))
44+
.filter((index) => index !== -1)
45+
46+
// Process each hunk
47+
for (const hunkStart of hunkStarts) {
48+
// Parse the hunk header
49+
const hunkHeader = diffLines[hunkStart]
50+
const match = hunkHeader.match(/@@ -(\d+),(\d+) \+(\d+),(\d+) @@/)
51+
52+
if (!match) {
53+
continue
54+
}
55+
56+
const oldStart = parseInt(match[1])
57+
const oldLines = parseInt(match[2])
58+
59+
// Extract the content lines for this hunk
60+
let i = hunkStart + 1
61+
const contentLines = []
62+
while (i < diffLines.length && !diffLines[i].startsWith('@@')) {
63+
contentLines.push(diffLines[i])
64+
i++
65+
}
66+
67+
// Build the old and new text
68+
let oldText = ''
69+
let newText = ''
70+
71+
for (const line of contentLines) {
72+
if (line.startsWith('-')) {
73+
oldText += line.substring(1) + '\n'
74+
} else if (line.startsWith('+')) {
75+
newText += line.substring(1) + '\n'
76+
} else if (line.startsWith(' ')) {
77+
oldText += line.substring(1) + '\n'
78+
newText += line.substring(1) + '\n'
79+
}
80+
}
81+
82+
// Remove trailing newline if it was added
83+
oldText = oldText.replace(/\n$/, '')
84+
newText = newText.replace(/\n$/, '')
85+
86+
// Find the text to replace in the document
87+
const docLines = docText.split('\n')
88+
const startLine = oldStart - 1 // Convert to 0-based
89+
const endLine = startLine + oldLines
90+
91+
// Extract the text that should be replaced
92+
const textToReplace = docLines.slice(startLine, endLine).join('\n')
93+
94+
// Replace the text
95+
result = result.replace(textToReplace, newText)
96+
}
97+
return {
98+
appliedCode: result,
99+
addedCharacterCount: addedCharacterCount,
100+
deletedCharacterCount: deletedCharacterCount,
101+
}
102+
} catch (error) {
103+
return {
104+
appliedCode: docText, // Return original text if all methods fail
105+
addedCharacterCount: 0,
106+
deletedCharacterCount: 0,
107+
}
108+
}
109+
}
110+
111+
export function getAddedAndDeletedCharCount(diff: string): {
112+
addedCharacterCount: number
113+
deletedCharacterCount: number
114+
} {
115+
let addedCharacterCount = 0
116+
let deletedCharacterCount = 0
117+
let i = 0
118+
const lines = diff.split('\n')
119+
while (i < lines.length) {
120+
const line = lines[i]
121+
if (line.startsWith('+') && !line.startsWith('+++')) {
122+
addedCharacterCount += line.length - 1
123+
} else if (line.startsWith('-') && !line.startsWith('---')) {
124+
const removedLine = line.substring(1)
125+
deletedCharacterCount += removedLine.length
126+
127+
// Check if this is a modified line rather than a pure deletion
128+
const nextLine = lines[i + 1]
129+
if (nextLine && nextLine.startsWith('+') && !nextLine.startsWith('+++') && nextLine.includes(removedLine)) {
130+
// This is a modified line, not a pure deletion
131+
// We've already counted the deletion, so we'll just increment i to skip the next line
132+
// since we'll process the addition on the next iteration
133+
i += 1
134+
}
135+
}
136+
i += 1
137+
}
138+
return {
139+
addedCharacterCount,
140+
deletedCharacterCount,
141+
}
142+
}

0 commit comments

Comments
 (0)