Skip to content

Commit

Permalink
Merge master into feature/emr
Browse files Browse the repository at this point in the history
  • Loading branch information
aws-toolkit-automation authored Nov 12, 2024
2 parents 16f6ad6 + 1c1fb06 commit 9f3c8f5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Bug Fix",
"description": "tutorial always showing on start"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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 {
Expand Down
17 changes: 12 additions & 5 deletions packages/core/src/codewhisperer/views/lineAnnotationController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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])
}

Expand Down

0 comments on commit 9f3c8f5

Please sign in to comment.