Skip to content

Commit 70cc369

Browse files
committed
fix(linter): dedupe
1 parent 63fcab2 commit 70cc369

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
@@ -134,8 +134,7 @@ export class InlineCompletionManager implements Disposable {
134134
To show prev. and next. recommendation we need to re-register a new provider with the previous or next item
135135
*/
136136

137-
const prevCommandHandler = async () => {
138-
this.sessionManager.decrementActiveIndex()
137+
const swapProviderAndShow = async () => {
139138
await commands.executeCommand('editor.action.inlineSuggest.hide')
140139
this.disposable.dispose()
141140
this.disposable = languages.registerInlineCompletionItemProvider(
@@ -149,22 +148,16 @@ export class InlineCompletionManager implements Disposable {
149148
)
150149
await commands.executeCommand('editor.action.inlineSuggest.trigger')
151150
}
151+
152+
const prevCommandHandler = async () => {
153+
this.sessionManager.decrementActiveIndex()
154+
await swapProviderAndShow()
155+
}
152156
commands.registerCommand('editor.action.inlineSuggest.showPrevious', prevCommandHandler)
153157

154158
const nextCommandHandler = async () => {
155159
this.sessionManager.incrementActiveIndex()
156-
await commands.executeCommand('editor.action.inlineSuggest.hide')
157-
this.disposable.dispose()
158-
this.disposable = languages.registerInlineCompletionItemProvider(
159-
CodewhispererInlineCompletionLanguages,
160-
new AmazonQInlineCompletionItemProvider(
161-
this.languageClient,
162-
this.recommendationService,
163-
this.sessionManager,
164-
false
165-
)
166-
)
167-
await commands.executeCommand('editor.action.inlineSuggest.trigger')
160+
await swapProviderAndShow()
168161
}
169162
commands.registerCommand('editor.action.inlineSuggest.showNext', nextCommandHandler)
170163
}

0 commit comments

Comments
 (0)