diff --git a/packages/amazonq/.changes/next-release/Bug Fix-46c5fb9b-1b36-4826-8520-ec03409bce79.json b/packages/amazonq/.changes/next-release/Bug Fix-46c5fb9b-1b36-4826-8520-ec03409bce79.json new file mode 100644 index 00000000000..f31507aa8f3 --- /dev/null +++ b/packages/amazonq/.changes/next-release/Bug Fix-46c5fb9b-1b36-4826-8520-ec03409bce79.json @@ -0,0 +1,4 @@ +{ + "type": "Bug Fix", + "description": "tutorial always showing on start" +} diff --git a/packages/amazonq/src/inlineChat/controller/inlineChatController.ts b/packages/amazonq/src/inlineChat/controller/inlineChatController.ts index 6d2d77eb172..ce0df6a0878 100644 --- a/packages/amazonq/src/inlineChat/controller/inlineChatController.ts +++ b/packages/amazonq/src/inlineChat/controller/inlineChatController.ts @@ -121,7 +121,10 @@ export class InlineChatController { await this.reset() } - public async updateTaskAndLenses(task: InlineTask, taskState?: TaskState) { + public async updateTaskAndLenses(task?: InlineTask, taskState?: TaskState) { + if (!task) { + return + } if (taskState) { task.state = taskState } else if (!task.diff || task.diff.length === 0) { @@ -200,7 +203,7 @@ export class InlineChatController { this.task = await this.createTask(query, editor.document, editor.selection) await this.inlineLineAnnotationController.disable(editor) await this.computeDiffAndRenderOnEditor(query, editor.document).catch(async (err) => { - getLogger().error(err) + getLogger().error('computeDiffAndRenderOnEditor error: %s', (err as Error)?.message) if (err instanceof Error) { void vscode.window.showErrorMessage(`Amazon Q: ${err.message}`) } else { diff --git a/packages/core/src/codewhisperer/views/lineAnnotationController.ts b/packages/core/src/codewhisperer/views/lineAnnotationController.ts index df00b6fe7ac..21e4045b113 100644 --- a/packages/core/src/codewhisperer/views/lineAnnotationController.ts +++ b/packages/core/src/codewhisperer/views/lineAnnotationController.ts @@ -38,6 +38,8 @@ function fromId(id: string | undefined): AnnotationState | undefined { return new TryMoreExState() case EndState.id: return new EndState() + case InlineChatState.id: + return new InlineChatState() default: return undefined } @@ -201,16 +203,15 @@ export class EndState implements AnnotationState { } export class InlineChatState implements AnnotationState { - static static = 'amazonq_annotation_inline_chat' - id = InlineChatState.static + static id = 'amazonq_annotation_inline_chat' + id = InlineChatState.id suppressWhileRunning = false text = () => { if (os.platform() === 'darwin') { return 'Amazon Q: Edit \u2318I' - } else { - return 'Amazon Q: Edit (Ctrl+I)' } + return 'Amazon Q: Edit (Ctrl+I)' } updateState(_changeSource: AnnotationChangeSource, _force: boolean): AnnotationState { return this @@ -329,6 +330,10 @@ export class LineAnnotationController implements vscode.Disposable { return this._currentState.id === new EndState().id } + isInlineChatHint(): boolean { + return this._currentState.id === new InlineChatState().id + } + async dismissTutorial() { this._currentState = new EndState() await setContext('aws.codewhisperer.tutorial.workInProgress', false) @@ -467,7 +472,9 @@ export class LineAnnotationController implements vscode.Disposable { decorationOptions.range = range await globals.globalState.update(inlinehintKey, this._currentState.id) - await setContext('aws.codewhisperer.tutorial.workInProgress', true) + if (!this.isInlineChatHint()) { + await setContext('aws.codewhisperer.tutorial.workInProgress', true) + } editor.setDecorations(this.cwLineHintDecoration, [decorationOptions]) }