Skip to content

Commit 3e21737

Browse files
authored
fix(amazonq): code reference codelense works (#7331)
builds off #7323 ## Problem - Code reference codelense doesn't open the code reference panel, it opens problems. - Sometimes the codelense never goes away. (Note: both of these bugs are on prod) ## Solution - Hide the codelense after 5 seconds. - Properly link the codelense to code reference log panel. ## Verification https://github.com/user-attachments/assets/3a231ab4-1e25-4746-864a-d66f5e852686 --- - 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.
1 parent 042ce00 commit 3e21737

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import {
3434
vsCodeState,
3535
inlineCompletionsDebounceDelay,
3636
noInlineSuggestionsMsg,
37+
ReferenceInlineProvider,
3738
} from 'aws-core-vscode/codewhisperer'
3839
import { InlineGeneratingMessage } from './inlineGeneratingMessage'
3940
import { LineTracker } from './stateTracker/lineTracker'
@@ -123,6 +124,16 @@ export class InlineCompletionManager implements Disposable {
123124
)
124125
ReferenceLogViewProvider.instance.addReferenceLog(referenceLog)
125126
ReferenceHoverProvider.instance.addCodeReferences(item.insertText as string, item.references)
127+
128+
// Show codelense for 5 seconds.
129+
ReferenceInlineProvider.instance.setInlineReference(
130+
startLine,
131+
item.insertText as string,
132+
item.references
133+
)
134+
setTimeout(() => {
135+
ReferenceInlineProvider.instance.removeInlineReference()
136+
}, 5000)
126137
}
127138
if (item.mostRelevantMissingImports?.length) {
128139
await ImportAdderProvider.instance.onAcceptRecommendation(editor, item, startLine)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export const showReferenceLog = Commands.declare(
145145
if (_ !== placeholder) {
146146
source = 'ellipsesMenu'
147147
}
148-
await vscode.commands.executeCommand('workbench.view.extension.aws-codewhisperer-reference-log')
148+
await vscode.commands.executeCommand(`${ReferenceLogViewProvider.viewType}.focus`)
149149
}
150150
)
151151

0 commit comments

Comments
 (0)