@@ -64,7 +64,6 @@ export class SuggestAddon extends Disposable implements ITerminalAddon, ISuggest
64
64
private _leadingLineContent ?: string ;
65
65
private _cursorIndexDelta : number = 0 ;
66
66
private _requestedCompletionsIndex : number = 0 ;
67
- private _providerReplacementIndex : number = 0 ;
68
67
69
68
private _lastUserData ?: string ;
70
69
static lastAcceptedCompletionTimestamp : number = 0 ;
@@ -171,11 +170,6 @@ export class SuggestAddon extends Disposable implements ITerminalAddon, ISuggest
171
170
}
172
171
this . _onDidReceiveCompletions . fire ( ) ;
173
172
174
- // ATM, the two providers calculate the same replacement index / prefix, so we can just take the first one
175
- // TODO: figure out if we can add support for multiple replacement indices
176
- const replacementIndices = [ ...new Set ( providedCompletions . map ( c => c . replacementIndex ) ) ] ;
177
- const replacementIndex = replacementIndices . length === 1 ? replacementIndices [ 0 ] : 0 ;
178
- this . _providerReplacementIndex = replacementIndex ;
179
173
this . _requestedCompletionsIndex = this . _promptInputModel . cursorIndex ;
180
174
181
175
this . _currentPromptInputState = {
@@ -186,7 +180,7 @@ export class SuggestAddon extends Disposable implements ITerminalAddon, ISuggest
186
180
ghostTextIndex : this . _promptInputModel . ghostTextIndex
187
181
} ;
188
182
189
- this . _leadingLineContent = this . _currentPromptInputState . prefix . substring ( replacementIndex , replacementIndex + this . _promptInputModel . cursorIndex + this . _cursorIndexDelta ) ;
183
+ this . _leadingLineContent = this . _currentPromptInputState . prefix . substring ( 0 , this . _requestedCompletionsIndex + this . _cursorIndexDelta ) ;
190
184
191
185
const completions = providedCompletions . flat ( ) ;
192
186
if ( ! completions ?. length ) {
@@ -339,7 +333,7 @@ export class SuggestAddon extends Disposable implements ITerminalAddon, ISuggest
339
333
340
334
if ( this . _terminalSuggestWidgetVisibleContextKey . get ( ) ) {
341
335
this . _cursorIndexDelta = this . _currentPromptInputState . cursorIndex - ( this . _requestedCompletionsIndex ) ;
342
- let normalizedLeadingLineContent = this . _currentPromptInputState . value . substring ( this . _providerReplacementIndex , this . _requestedCompletionsIndex + this . _cursorIndexDelta ) ;
336
+ let normalizedLeadingLineContent = this . _currentPromptInputState . value . substring ( 0 , this . _requestedCompletionsIndex + this . _cursorIndexDelta ) ;
343
337
if ( this . _isFilteringDirectories ) {
344
338
normalizedLeadingLineContent = normalizePathSeparator ( normalizedLeadingLineContent , this . _pathSeparator ) ;
345
339
}
@@ -458,7 +452,7 @@ export class SuggestAddon extends Disposable implements ITerminalAddon, ISuggest
458
452
// The replacement text is any text after the replacement index for the completions, this
459
453
// includes any text that was there before the completions were requested and any text added
460
454
// since to refine the completion.
461
- const replacementText = currentPromptInputState . value . substring ( suggestion . item . completion . replacementIndex ?? this . _providerReplacementIndex , currentPromptInputState . cursorIndex ) ;
455
+ const replacementText = currentPromptInputState . value . substring ( suggestion . item . completion . replacementIndex , currentPromptInputState . cursorIndex ) ;
462
456
463
457
// Right side of replacement text in the same word
464
458
let rightSideReplacementText = '' ;
0 commit comments