@@ -99,7 +99,9 @@ export class InlineCompletion {
99
99
}
100
100
101
101
async acceptRecommendation ( editor : vscode . TextEditor ) {
102
- if ( vsCodeState . isCodeWhispererEditing ) return
102
+ if ( vsCodeState . isCodeWhispererEditing ) {
103
+ return
104
+ }
103
105
vsCodeState . isCodeWhispererEditing = true
104
106
await editor
105
107
?. edit (
@@ -142,8 +144,12 @@ export class InlineCompletion {
142
144
isTypeAheadRejection : boolean = false ,
143
145
onDidChangeVisibleTextEditors : boolean = false
144
146
) {
145
- if ( ! editor || vsCodeState . isCodeWhispererEditing ) return
146
- if ( ! isTypeAheadRejection && this . items . length === 0 ) return
147
+ if ( ! editor || vsCodeState . isCodeWhispererEditing ) {
148
+ return
149
+ }
150
+ if ( ! isTypeAheadRejection && this . items . length === 0 ) {
151
+ return
152
+ }
147
153
vsCodeState . isCodeWhispererEditing = true
148
154
ReferenceInlineProvider . instance . removeInlineReference ( )
149
155
if ( onDidChangeVisibleTextEditors && this . documentUri && this . documentUri . fsPath . length > 0 ) {
@@ -261,8 +267,11 @@ export class InlineCompletion {
261
267
* When typeAhead is involved we set the position of character with one more character to net let
262
268
* last bracket of recommendation to be removed
263
269
*/
264
- if ( this . isTypeaheadInProgress ) this . setRange ( new vscode . Range ( this . _range . start , pos ) )
265
- else this . setRange ( new vscode . Range ( this . _range . start , editor . selection . active ) )
270
+ if ( this . isTypeaheadInProgress ) {
271
+ this . setRange ( new vscode . Range ( this . _range . start , pos ) )
272
+ } else {
273
+ this . setRange ( new vscode . Range ( this . _range . start , editor . selection . active ) )
274
+ }
266
275
editor . setDecorations ( this . dimDecoration , [ this . _range ] )
267
276
// cursor position
268
277
const position = editor . selection . active
@@ -291,7 +300,9 @@ export class InlineCompletion {
291
300
}
292
301
293
302
async navigateRecommendation ( editor : vscode . TextEditor , next : boolean ) {
294
- if ( ! this . items ?. length || this . items . length === 1 || vsCodeState . isCodeWhispererEditing || ! editor ) return
303
+ if ( ! this . items ?. length || this . items . length === 1 || vsCodeState . isCodeWhispererEditing || ! editor ) {
304
+ return
305
+ }
295
306
vsCodeState . isCodeWhispererEditing = true
296
307
if ( next ) {
297
308
if ( this . position === this . items . length - 1 ) {
@@ -348,7 +359,9 @@ export class InlineCompletion {
348
359
RecommendationHandler . instance . clearRecommendations ( )
349
360
break
350
361
}
351
- if ( ! RecommendationHandler . instance . hasNextToken ( ) ) break
362
+ if ( ! RecommendationHandler . instance . hasNextToken ( ) ) {
363
+ break
364
+ }
352
365
page ++
353
366
}
354
367
} catch ( error ) {
0 commit comments