Skip to content

Commit 0aa082d

Browse files
authored
Merge branch 'master' into master
2 parents 6ef0a47 + 9f805be commit 0aa082d

Some content is hidden

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

42 files changed

+469
-235
lines changed

docs/lsp.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,16 @@ sequenceDiagram
4545
npm run package
4646
```
4747
to get the project setup
48-
3. Uncomment the `__AMAZONQLSP_PATH` variable in `amazonq/.vscode/launch.json` Extension configuration
49-
4. Use the `Launch LSP with Debugging` configuration and set breakpoints in VSCode or the language server
48+
3. Enable the lsp experiment:
49+
```
50+
"aws.experiments": {
51+
"amazonqLSP": true,
52+
"amazonqLSPInline": true, // optional: enables inline completion from flare
53+
"amazonqLSPChat": true // optional: enables chat from flare
54+
}
55+
```
56+
4. Uncomment the `__AMAZONQLSP_PATH` variable in `amazonq/.vscode/launch.json` Extension configuration
57+
5. Use the `Launch LSP with Debugging` configuration and set breakpoints in VSCode or the language server
5058
5159
## Amazon Q Inline Activation
5260

package-lock.json

Lines changed: 28 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
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": "Amazon Q chat: `@prompts` not added to context"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "SageMaker Unified Studio: Disable Sign out"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "SageMaker Unified Studio: Update Q Chat Introduction message"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "Amazon Q chat: Code blocks in chat messages have a max-height of 21 lines and can be scrolled inside"
4+
}

packages/amazonq/package.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,14 @@
119119
"ssoCacheError": {
120120
"type": "boolean",
121121
"default": false
122+
},
123+
"amazonQLspManifestMessage": {
124+
"type": "boolean",
125+
"default": false
126+
},
127+
"amazonQWorkspaceLspManifestMessage": {
128+
"type": "boolean",
129+
"default": false
122130
}
123131
},
124132
"additionalProperties": false
@@ -351,7 +359,7 @@
351359
},
352360
{
353361
"command": "aws.amazonq.signout",
354-
"when": "(view == aws.amazonq.AmazonQChatView) && aws.codewhisperer.connected",
362+
"when": "(view == aws.amazonq.AmazonQChatView) && aws.codewhisperer.connected && !aws.isSageMakerUnifiedStudio",
355363
"group": "2_amazonQ@4"
356364
},
357365
{
@@ -627,7 +635,7 @@
627635
"title": "%AWS.command.codewhisperer.signout%",
628636
"category": "%AWS.amazonq.title%",
629637
"icon": "$(debug-disconnect)",
630-
"enablement": "aws.codewhisperer.connected"
638+
"enablement": "aws.codewhisperer.connected && !aws.isSageMakerUnifiedStudio"
631639
},
632640
{
633641
"command": "aws.amazonq.learnMore",

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import {
2929
ReferenceHoverProvider,
3030
ReferenceInlineProvider,
3131
ReferenceLogViewProvider,
32+
ImportAdderProvider,
3233
} from 'aws-core-vscode/codewhisperer'
3334

3435
export class InlineCompletionManager implements Disposable {
@@ -66,6 +67,7 @@ export class InlineCompletionManager implements Disposable {
6667
item: InlineCompletionItemWithReferences,
6768
editor: TextEditor,
6869
requestStartTime: number,
70+
startLine: number,
6971
firstCompletionDisplayLatency?: number
7072
) => {
7173
// TODO: also log the seen state for other suggestions in session
@@ -96,6 +98,9 @@ export class InlineCompletionManager implements Disposable {
9698
ReferenceLogViewProvider.instance.addReferenceLog(referenceLog)
9799
ReferenceHoverProvider.instance.addCodeReferences(item.insertText as string, item.references)
98100
}
101+
if (item.mostRelevantMissingImports?.length) {
102+
await ImportAdderProvider.instance.onAcceptRecommendation(editor, item, startLine)
103+
}
99104
}
100105
commands.registerCommand('aws.amazonq.acceptInline', onInlineAcceptance)
101106

@@ -200,6 +205,7 @@ export class AmazonQInlineCompletionItemProvider implements InlineCompletionItem
200205
item,
201206
editor,
202207
session.requestStartTime,
208+
position.line,
203209
session.firstCompletionDisplayLatency,
204210
],
205211
}
@@ -208,6 +214,7 @@ export class AmazonQInlineCompletionItemProvider implements InlineCompletionItem
208214
item.insertText as string,
209215
item.references
210216
)
217+
ImportAdderProvider.instance.onShowRecommendation(document, position.line, item)
211218
}
212219
return items as InlineCompletionItem[]
213220
}

packages/amazonq/src/extension.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {
3232
setupUninstallHandler,
3333
maybeShowMinVscodeWarning,
3434
Experiments,
35+
isSageMaker,
3536
} from 'aws-core-vscode/shared'
3637
import { ExtStartUpSources } from 'aws-core-vscode/telemetry'
3738
import { VSCODE_EXTENSION_ID } from 'aws-core-vscode/utils'
@@ -120,7 +121,9 @@ export async function activateAmazonQCommon(context: vscode.ExtensionContext, is
120121
await activateCodeWhisperer(extContext as ExtContext)
121122
if (Experiments.instance.get('amazonqLSP', false)) {
122123
await activateAmazonqLsp(context)
123-
} else {
124+
}
125+
126+
if (!Experiments.instance.get('amazonqLSPInline', false)) {
124127
await activateInlineCompletion()
125128
}
126129

@@ -144,6 +147,9 @@ export async function activateAmazonQCommon(context: vscode.ExtensionContext, is
144147
// Hide the Amazon Q tree in toolkit explorer
145148
await setContext('aws.toolkit.amazonq.dismissed', true)
146149

150+
// set context var to check if its SageMaker Unified Studio or not
151+
await setContext('aws.isSageMakerUnifiedStudio', isSageMaker('SMUS'))
152+
147153
// reload webviews
148154
await vscode.commands.executeCommand('workbench.action.webview.reloadWebviewAction')
149155

@@ -157,7 +163,7 @@ export async function activateAmazonQCommon(context: vscode.ExtensionContext, is
157163

158164
context.subscriptions.push(
159165
Experiments.instance.onDidChange(async (event) => {
160-
if (event.key === 'amazonqLSP' || event.key === 'amazonqChatLSP') {
166+
if (event.key === 'amazonqLSP' || event.key === 'amazonqChatLSP' || event.key === 'amazonqLSPInline') {
161167
await vscode.window
162168
.showInformationMessage(
163169
'Amazon Q LSP setting has changed. Reload VS Code for the changes to take effect.',

packages/amazonq/src/lsp/activation.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,14 @@
66
import vscode from 'vscode'
77
import { startLanguageServer } from './client'
88
import { AmazonQLspInstaller } from './lspInstaller'
9-
import { Commands, lspSetupStage, ToolkitError } from 'aws-core-vscode/shared'
9+
import { lspSetupStage, ToolkitError } from 'aws-core-vscode/shared'
1010

1111
export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
1212
try {
1313
await lspSetupStage('all', async () => {
1414
const installResult = await new AmazonQLspInstaller().resolve()
1515
await lspSetupStage('launch', async () => await startLanguageServer(ctx, installResult.resourcePaths))
1616
})
17-
ctx.subscriptions.push(
18-
Commands.register({ id: 'aws.amazonq.invokeInlineCompletion', autoconnect: true }, async () => {
19-
await vscode.commands.executeCommand('editor.action.inlineSuggest.trigger')
20-
}),
21-
vscode.workspace.onDidCloseTextDocument(async () => {
22-
await vscode.commands.executeCommand('aws.amazonq.rejectCodeSuggestion')
23-
})
24-
)
2517
} catch (err) {
2618
const e = err as ToolkitError
2719
void vscode.window.showInformationMessage(`Unable to launch amazonq language server: ${e.message}`)

0 commit comments

Comments
 (0)