Skip to content

Commit f23f978

Browse files
authored
Merge branch 'master' into nep-flare
2 parents aa43192 + 2f39da8 commit f23f978

25 files changed

+314
-167
lines changed

docs/lsp.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ sequenceDiagram
2525
```
2626

2727
## Language Server Debugging
28+
If you want to connect a local version of language-servers to aws-toolkit-vscode, follow these steps:
2829

2930
1. Clone https://github.com/aws/language-servers.git and set it up in the same workspace as this project by cmd+shift+p and "add folder to workspace" and selecting the language-servers folder that you just cloned. Your VS code folder structure should look like below.
3031

@@ -55,6 +56,43 @@ sequenceDiagram
5556
5. Use the `Launch LSP with Debugging` configuration and set breakpoints in VSCode or the language server, Once you run "Launch LSP with Debugging" a new window should start, wait for the plugin to show up there. Then go to the run menu again and run "Attach to Language Server (amazonq)" after this you should be able to add breakpoints in the LSP code.
5657
6. (Optional): Enable `"amazonq.trace.server": "on"` or `"amazonq.trace.server": "verbose"` in your VSCode settings to view detailed log messages sent to/from the language server. These log messages will show up in the "Amazon Q Language Server" output channel
5758
59+
### Breakpoints Work-Around
60+
If the breakpoints in your language-servers project remain greyed out and do not trigger when you run `Launch LSP with Debugging`, your debugger may be attaching to the language server before it has launched. You can follow the work-around below to avoid this problem. If anyone fixes this issue, please remove this section.
61+
1. Set your breakpoints and click `Launch LSP with Debugging`
62+
2. Once the debugging session has started, click `Launch LSP with Debugging` again, then `Cancel` on any pop-ups that appear
63+
3. On the debug panel, click `Attach to Language Server (amazonq)` next to the red stop button
64+
4. Click `Launch LSP with Debugging` again, then `Cancel` on any pop-ups that appear
65+
66+
## Language Server Runtimes Debugging
67+
If you want to connect a local version of language-server-runtimes to aws-toolkit-vscode, follow these steps:
68+
69+
1. Clone https://github.com/aws/language-server-runtimes.git and set it up in the same workspace as this project by cmd+shift+p and "add folder to workspace" and selecting the language-server-runtimes folder that you just cloned. Your VS code folder structure should look like below.
70+
71+
```
72+
/aws-toolkit-vscode
73+
/toolkit
74+
/core
75+
/amazonq
76+
/language-server-runtimes
77+
```
78+
2. Inside of the language-server-runtimes project run:
79+
```
80+
npm install
81+
npm run compile
82+
cd runtimes
83+
npm run prepub
84+
cd out
85+
npm link
86+
cd ../../types
87+
npm link
88+
```
89+
If you get an error running `npm run prepub`, you can instead run `npm run prepub:copyFiles` to skip cleaning and testing.
90+
3. Inside of aws-toolkit-vscode run:
91+
```
92+
npm install
93+
npm link @aws/language-server-runtimes @aws/language-server-runtimes-types
94+
```
95+
5896
## Amazon Q Inline Activation
5997
6098
- In order to get inline completion working you must open a supported file type defined in CodewhispererInlineCompletionLanguages in `packages/amazonq/src/app/inline/completion.ts`

package-lock.json

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

packages/amazonq/.changes/1.83.0.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"date": "2025-07-09",
3+
"version": "1.83.0",
4+
"entries": [
5+
{
6+
"type": "Feature",
7+
"description": "Amazon Q /test, /doc, and /dev capabilities integrated into Agentic coding."
8+
},
9+
{
10+
"type": "Feature",
11+
"description": "Added image support to Amazon Q chat, users can now upload images from their local file system"
12+
},
13+
{
14+
"type": "Removal",
15+
"description": "Deprecate \"amazon q is generating...\" UI for inline suggestion"
16+
}
17+
]
18+
}

packages/amazonq/.changes/next-release/Feature-a37e21b7-a68f-4554-92c9-9db35c0a3e51.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/amazonq/.changes/next-release/Removal-083c6e6d-e543-4df7-86ae-0c0f8c0a27ee.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/amazonq/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 1.83.0 2025-07-09
2+
3+
- **Feature** Amazon Q /test, /doc, and /dev capabilities integrated into Agentic coding.
4+
- **Feature** Added image support to Amazon Q chat, users can now upload images from their local file system
5+
- **Removal** Deprecate "amazon q is generating..." UI for inline suggestion
6+
17
## 1.82.0 2025-07-07
28

39
- **Bug Fix** Prompt re-authenticate if auto trigger failed with expired token

packages/amazonq/package.json

Lines changed: 1 addition & 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.83.0-SNAPSHOT",
5+
"version": "1.84.0-SNAPSHOT",
66
"extensionKind": [
77
"workspace"
88
],

packages/amazonq/src/app/inline/EditRendering/displayImage.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { InlineCompletionItemWithReferences } from '@aws/language-server-runtime
1313
import path from 'path'
1414
import { imageVerticalOffset } from './svgGenerator'
1515
import { AmazonQInlineCompletionItemProvider } from '../completion'
16+
import { vsCodeState } from 'aws-core-vscode/codewhisperer'
1617

1718
export class EditDecorationManager {
1819
private imageDecorationType: vscode.TextEditorDecorationType
@@ -211,7 +212,7 @@ export const decorationManager = EditDecorationManager.getDecorationManager()
211212
/**
212213
* Function to replace editor's content with new code
213214
*/
214-
function replaceEditorContent(editor: vscode.TextEditor, newCode: string): void {
215+
async function replaceEditorContent(editor: vscode.TextEditor, newCode: string): Promise<void> {
215216
const document = editor.document
216217
const fullRange = new vscode.Range(
217218
0,
@@ -220,7 +221,7 @@ function replaceEditorContent(editor: vscode.TextEditor, newCode: string): void
220221
document.lineAt(document.lineCount - 1).text.length
221222
)
222223

223-
void editor.edit((editBuilder) => {
224+
await editor.edit((editBuilder) => {
224225
editBuilder.replace(fullRange, newCode)
225226
})
226227
}
@@ -294,7 +295,12 @@ export async function displaySvgDecoration(
294295
getLogger().info('Edit suggestion accepted')
295296

296297
// Replace content
297-
replaceEditorContent(editor, newCode)
298+
try {
299+
vsCodeState.isCodeWhispererEditing = true
300+
await replaceEditorContent(editor, newCode)
301+
} finally {
302+
vsCodeState.isCodeWhispererEditing = false
303+
}
298304

299305
// Move cursor to end of the actual changed content
300306
const endPosition = getEndOfEditPosition(originalCode, newCode)
@@ -320,7 +326,7 @@ export async function displaySvgDecoration(
320326
languageClient.sendNotification('aws/logInlineCompletionSessionResults', params)
321327
session.triggerOnAcceptance = true
322328
// VS Code triggers suggestion on every keystroke, temporarily disable trigger on acceptance
323-
// if (inlineCompletionProvider) {
329+
// if (inlineCompletionProvider && session.editsStreakPartialResultToken) {
324330
// await inlineCompletionProvider.provideInlineCompletionItems(
325331
// editor.document,
326332
// endPosition,

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

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ import {
3535
inlineCompletionsDebounceDelay,
3636
noInlineSuggestionsMsg,
3737
ReferenceInlineProvider,
38+
getDiagnosticsDifferences,
39+
getDiagnosticsOfCurrentFile,
40+
toIdeDiagnostics,
3841
} from 'aws-core-vscode/codewhisperer'
3942
import { LineTracker } from './stateTracker/lineTracker'
4043
import { InlineTutorialAnnotation } from './tutorials/inlineTutorialAnnotation'
@@ -116,6 +119,13 @@ export class InlineCompletionManager implements Disposable {
116119
firstCompletionDisplayLatency?: number
117120
) => {
118121
// TODO: also log the seen state for other suggestions in session
122+
// Calculate timing metrics before diagnostic delay
123+
const totalSessionDisplayTime = performance.now() - requestStartTime
124+
await sleep(1000)
125+
const diagnosticDiff = getDiagnosticsDifferences(
126+
this.sessionManager.getActiveSession()?.diagnosticsBeforeAccept,
127+
getDiagnosticsOfCurrentFile()
128+
)
119129
const params: LogInlineCompletionSessionResultsParams = {
120130
sessionId: sessionId,
121131
completionSessionResult: {
@@ -125,8 +135,10 @@ export class InlineCompletionManager implements Disposable {
125135
discarded: false,
126136
},
127137
},
128-
totalSessionDisplayTime: Date.now() - requestStartTime,
138+
totalSessionDisplayTime: totalSessionDisplayTime,
129139
firstCompletionDisplayLatency: firstCompletionDisplayLatency,
140+
addedDiagnostics: diagnosticDiff.added.map((it) => toIdeDiagnostics(it)),
141+
removedDiagnostics: diagnosticDiff.removed.map((it) => toIdeDiagnostics(it)),
130142
}
131143
this.languageClient.sendNotification(this.logSessionResultMessageName, params)
132144
this.disposable.dispose()
@@ -221,13 +233,20 @@ export class AmazonQInlineCompletionItemProvider implements InlineCompletionItem
221233
position,
222234
context,
223235
triggerKind: context.triggerKind === InlineCompletionTriggerKind.Automatic ? 'Automatic' : 'Invoke',
236+
options: JSON.stringify(getAllRecommendationsOptions),
224237
})
225238

226239
// prevent concurrent API calls and write to shared state variables
227240
if (vsCodeState.isRecommendationsActive) {
228241
getLogger().info('Recommendations already active, returning empty')
229242
return []
230243
}
244+
245+
if (vsCodeState.isCodeWhispererEditing) {
246+
getLogger().info('Q is editing, returning empty')
247+
return []
248+
}
249+
231250
// yield event loop to let the document listen catch updates
232251
await sleep(1)
233252
// prevent user deletion invoking auto trigger
@@ -335,6 +354,7 @@ export class AmazonQInlineCompletionItemProvider implements InlineCompletionItem
335354
const t2 = performance.now()
336355

337356
logstr = logstr += `- number of suggestions: ${items.length}
357+
- sessionId: ${this.sessionManager.getActiveSession()?.sessionId}
338358
- first suggestion content (next line):
339359
${itemLog}
340360
- duration since trigger to before sending Flare call: ${t1 - t0}ms
@@ -382,11 +402,10 @@ ${itemLog}
382402
if (item.isInlineEdit) {
383403
// Check if Next Edit Prediction feature flag is enabled
384404
if (Experiments.instance.isExperimentEnabled('amazonqLSPNEP')) {
385-
void showEdits(item, editor, session, this.languageClient, this).then(() => {
386-
const t3 = performance.now()
387-
logstr = logstr + `- duration since trigger to NEP suggestion is displayed: ${t3 - t0}ms`
388-
this.logger.info(logstr)
389-
})
405+
await showEdits(item, editor, session, this.languageClient, this)
406+
const t3 = performance.now()
407+
logstr = logstr + `- duration since trigger to NEP suggestion is displayed: ${t3 - t0}ms`
408+
this.logger.info(logstr)
390409
}
391410
return []
392411
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export class RecommendationService {
7777
textDocument: request.textDocument,
7878
position: request.position,
7979
context: request.context,
80-
partialResultToken: request.partialResultToken,
80+
nextToken: request.partialResultToken,
8181
},
8282
})
8383
let result: InlineCompletionListWithReferences = await languageClient.sendRequest(

0 commit comments

Comments
 (0)