Skip to content

Commit ab89cd4

Browse files
committed
fix(linter): dedupe
1 parent 10ee225 commit ab89cd4

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

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

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ export class InlineCompletionManager implements Disposable {
106106
To show prev. and next. recommendation we need to re-register a new provider with the previous or next item
107107
*/
108108

109-
const prevCommandHandler = async () => {
110-
this.sessionManager.decrementActiveIndex()
109+
const swapProviderAndShow = async () => {
111110
await commands.executeCommand('editor.action.inlineSuggest.hide')
112111
this.disposable.dispose()
113112
this.disposable = languages.registerInlineCompletionItemProvider(
@@ -121,22 +120,16 @@ export class InlineCompletionManager implements Disposable {
121120
)
122121
await commands.executeCommand('editor.action.inlineSuggest.trigger')
123122
}
123+
124+
const prevCommandHandler = async () => {
125+
this.sessionManager.decrementActiveIndex()
126+
await swapProviderAndShow()
127+
}
124128
commands.registerCommand('editor.action.inlineSuggest.showPrevious', prevCommandHandler)
125129

126130
const nextCommandHandler = async () => {
127131
this.sessionManager.incrementActiveIndex()
128-
await commands.executeCommand('editor.action.inlineSuggest.hide')
129-
this.disposable.dispose()
130-
this.disposable = languages.registerInlineCompletionItemProvider(
131-
CodeWhispererConstants.platformLanguageIds,
132-
new AmazonQInlineCompletionItemProvider(
133-
this.languageClient,
134-
this.recommendationService,
135-
this.sessionManager,
136-
false
137-
)
138-
)
139-
await commands.executeCommand('editor.action.inlineSuggest.trigger')
132+
await swapProviderAndShow()
140133
}
141134
commands.registerCommand('editor.action.inlineSuggest.showNext', nextCommandHandler)
142135
}

0 commit comments

Comments
 (0)