@@ -12,15 +12,14 @@ import { IConfigurationService } from '../../../../../platform/configuration/com
12
12
import { IFileService } from '../../../../../platform/files/common/files.js' ;
13
13
import { createDecorator } from '../../../../../platform/instantiation/common/instantiation.js' ;
14
14
import { TerminalCapability , type ITerminalCapabilityStore } from '../../../../../platform/terminal/common/capabilities/capabilities.js' ;
15
- import { GeneralShellType , TerminalShellType , WindowsShellType } from '../../../../../platform/terminal/common/terminal.js' ;
15
+ import { GeneralShellType , ITerminalLogService , TerminalShellType , WindowsShellType } from '../../../../../platform/terminal/common/terminal.js' ;
16
16
import { TerminalSuggestSettingId } from '../common/terminalSuggestConfiguration.js' ;
17
17
import { TerminalCompletionItemKind , type ITerminalCompletion } from './terminalCompletionItem.js' ;
18
18
import { env as processEnv } from '../../../../../base/common/process.js' ;
19
19
import type { IProcessEnvironment } from '../../../../../base/common/platform.js' ;
20
20
import { timeout } from '../../../../../base/common/async.js' ;
21
21
import { gitBashToWindowsPath } from './terminalGitBashHelpers.js' ;
22
22
import { isEqual } from '../../../../../base/common/resources.js' ;
23
- import { ILogService } from '../../../../../platform/log/common/log.js' ;
24
23
25
24
export const ITerminalCompletionService = createDecorator < ITerminalCompletionService > ( 'terminalCompletionService' ) ;
26
25
@@ -104,7 +103,7 @@ export class TerminalCompletionService extends Disposable implements ITerminalCo
104
103
constructor (
105
104
@IConfigurationService private readonly _configurationService : IConfigurationService ,
106
105
@IFileService private readonly _fileService : IFileService ,
107
- @ILogService private readonly _logService : ILogService
106
+ @ITerminalLogService private readonly _logService : ITerminalLogService
108
107
) {
109
108
super ( ) ;
110
109
}
@@ -132,6 +131,7 @@ export class TerminalCompletionService extends Disposable implements ITerminalCo
132
131
}
133
132
134
133
async provideCompletions ( promptValue : string , cursorPosition : number , allowFallbackCompletions : boolean , shellType : TerminalShellType | undefined , capabilities : ITerminalCapabilityStore , token : CancellationToken , triggerCharacter ?: boolean , skipExtensionCompletions ?: boolean , explicitlyInvoked ?: boolean ) : Promise < ITerminalCompletion [ ] | undefined > {
134
+ this . _logService . trace ( 'TerminalCompletionService#provideCompletions' ) ;
135
135
if ( ! this . _providers || ! this . _providers . values || cursorPosition < 0 ) {
136
136
return undefined ;
137
137
}
@@ -178,6 +178,7 @@ export class TerminalCompletionService extends Disposable implements ITerminalCo
178
178
}
179
179
180
180
private async _collectCompletions ( providers : ITerminalCompletionProvider [ ] , shellType : TerminalShellType | undefined , promptValue : string , cursorPosition : number , allowFallbackCompletions : boolean , capabilities : ITerminalCapabilityStore , token : CancellationToken , explicitlyInvoked ?: boolean ) : Promise < ITerminalCompletion [ ] | undefined > {
181
+ this . _logService . trace ( 'TerminalCompletionService#_collectCompletions' ) ;
181
182
const completionPromises = providers . map ( async provider => {
182
183
if ( provider . shellTypes && shellType && ! provider . shellTypes . includes ( shellType ) ) {
183
184
return undefined ;
@@ -187,7 +188,10 @@ export class TerminalCompletionService extends Disposable implements ITerminalCo
187
188
let completions ;
188
189
try {
189
190
completions = await Promise . race ( [
190
- provider . provideCompletions ( promptValue , cursorPosition , allowFallbackCompletions , token ) ,
191
+ provider . provideCompletions ( promptValue , cursorPosition , allowFallbackCompletions , token ) . then ( result => {
192
+ this . _logService . trace ( `TerminalCompletionService#_collectCompletions provider ${ provider . id } finished` ) ;
193
+ return result ;
194
+ } ) ,
191
195
( async ( ) => { await timeout ( timeoutMs ) ; timedOut = true ; return undefined ; } ) ( )
192
196
] ) ;
193
197
} catch ( e ) {
@@ -202,6 +206,7 @@ export class TerminalCompletionService extends Disposable implements ITerminalCo
202
206
return undefined ;
203
207
}
204
208
const completionItems = Array . isArray ( completions ) ? completions : completions . items ?? [ ] ;
209
+ this . _logService . trace ( `TerminalCompletionService#_collectCompletions amend ${ completionItems . length } completion items` ) ;
205
210
if ( shellType === GeneralShellType . PowerShell ) {
206
211
for ( const completion of completionItems ) {
207
212
completion . isFileOverride ??= completion . kind === TerminalCompletionItemKind . Method && completion . replacementIndex === 0 ;
@@ -236,6 +241,8 @@ export class TerminalCompletionService extends Disposable implements ITerminalCo
236
241
}
237
242
238
243
async resolveResources ( resourceRequestConfig : TerminalResourceRequestConfig , promptValue : string , cursorPosition : number , provider : string , capabilities : ITerminalCapabilityStore , shellType ?: TerminalShellType ) : Promise < ITerminalCompletion [ ] | undefined > {
244
+ this . _logService . trace ( `TerminalCompletionService#resolveResources` ) ;
245
+
239
246
const useWindowsStylePath = resourceRequestConfig . pathSeparator === '\\' ;
240
247
if ( useWindowsStylePath ) {
241
248
// for tests, make sure the right path separator is used
0 commit comments