@@ -21,12 +21,10 @@ import { withNullAsUndefined } from 'vs/base/common/types';
21
21
import { OperatingSystem , OS } from 'vs/base/common/platform' ;
22
22
import { TerminalEditorLocationOptions } from 'vscode' ;
23
23
import { Promises } from 'vs/base/common/async' ;
24
- import { CancellationToken } from 'vs/base/common/cancellation' ;
25
- import { ITerminalCommand } from 'vs/platform/terminal/common/capabilities/capabilities' ;
26
24
import { TerminalQuickFixType } from 'vs/workbench/api/common/extHostTypes' ;
27
25
import { ISerializableEnvironmentDescriptionMap , ISerializableEnvironmentVariableCollection } from 'vs/platform/terminal/common/environmentVariable' ;
28
26
import { ITerminalLinkProviderService } from 'vs/workbench/contrib/terminalContrib/links/browser/links' ;
29
- import { ITerminalQuickFixService , ITerminalQuickFixOptions , ITerminalQuickFix } from 'vs/workbench/contrib/terminalContrib/quickFix/browser/quickFix' ;
27
+ import { ITerminalQuickFixService , ITerminalQuickFix } from 'vs/workbench/contrib/terminalContrib/quickFix/browser/quickFix' ;
30
28
31
29
32
30
@extHostNamedCustomer ( MainContext . MainThreadTerminalService )
@@ -261,42 +259,40 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
261
259
}
262
260
263
261
public async $registerQuickFixProvider ( id : string , extensionId : string ) : Promise < void > {
264
- this . _quickFixProviders . set ( id , this . _terminalQuickFixService . registerQuickFixProvider ( id ,
265
- {
266
- provideTerminalQuickFixes : async ( terminalCommand : ITerminalCommand , lines : string [ ] , option : ITerminalQuickFixOptions , token : CancellationToken ) => {
267
- if ( token . isCancellationRequested ) {
268
- return ;
269
- }
270
- if ( option . outputMatcher ?. length && option . outputMatcher . length > 40 ) {
271
- option . outputMatcher . length = 40 ;
272
- this . _logService . warn ( 'Cannot exceed output matcher length of 40' ) ;
273
- }
274
- const commandLineMatch = terminalCommand . command . match ( option . commandLineMatcher ) ;
275
- if ( ! commandLineMatch ) {
276
- return ;
277
- }
278
- const outputMatcher = option . outputMatcher ;
279
- let outputMatch ;
280
- if ( outputMatcher ) {
281
- outputMatch = getOutputMatchForLines ( lines , outputMatcher ) ;
282
- }
283
- if ( ! outputMatch ) {
284
- return ;
285
- }
286
- const matchResult = { commandLineMatch, outputMatch, commandLine : terminalCommand . command } ;
287
-
288
- if ( matchResult ) {
289
- const result = await this . _proxy . $provideTerminalQuickFixes ( id , matchResult , token ) ;
290
- if ( result && Array . isArray ( result ) ) {
291
- return result . map ( r => parseQuickFix ( id , extensionId , r ) ) ;
292
- } else if ( result ) {
293
- return parseQuickFix ( id , extensionId , result ) ;
294
- }
295
- }
262
+ this . _quickFixProviders . set ( id , this . _terminalQuickFixService . registerQuickFixProvider ( id , {
263
+ provideTerminalQuickFixes : async ( terminalCommand , lines , options , token ) => {
264
+ if ( token . isCancellationRequested ) {
265
+ return ;
266
+ }
267
+ if ( options . outputMatcher ?. length && options . outputMatcher . length > 40 ) {
268
+ options . outputMatcher . length = 40 ;
269
+ this . _logService . warn ( 'Cannot exceed output matcher length of 40' ) ;
270
+ }
271
+ const commandLineMatch = terminalCommand . command . match ( options . commandLineMatcher ) ;
272
+ if ( ! commandLineMatch || ! lines ) {
273
+ return ;
274
+ }
275
+ const outputMatcher = options . outputMatcher ;
276
+ let outputMatch ;
277
+ if ( outputMatcher ) {
278
+ outputMatch = getOutputMatchForLines ( lines , outputMatcher ) ;
279
+ }
280
+ if ( ! outputMatch ) {
296
281
return ;
297
282
}
298
- } )
299
- ) ;
283
+ const matchResult = { commandLineMatch, outputMatch, commandLine : terminalCommand . command } ;
284
+
285
+ if ( matchResult ) {
286
+ const result = await this . _proxy . $provideTerminalQuickFixes ( id , matchResult , token ) ;
287
+ if ( result && Array . isArray ( result ) ) {
288
+ return result . map ( r => parseQuickFix ( id , extensionId , r ) ) ;
289
+ } else if ( result ) {
290
+ return parseQuickFix ( id , extensionId , result ) ;
291
+ }
292
+ }
293
+ return ;
294
+ }
295
+ } ) ) ;
300
296
}
301
297
302
298
public $unregisterQuickFixProvider ( id : string ) : void {
0 commit comments