@@ -7,7 +7,7 @@ import { timeout } from 'vs/base/common/async';
7
7
import { debounce } from 'vs/base/common/decorators' ;
8
8
import { Emitter } from 'vs/base/common/event' ;
9
9
import { ILogService } from 'vs/platform/log/common/log' ;
10
- import { ICommandDetectionCapability , TerminalCapability , ITerminalCommand , IHandleCommandOptions , ICommandInvalidationRequest , CommandInvalidationReason , ISerializedCommand , ISerializedCommandDetectionCapability } from 'vs/platform/terminal/common/capabilities/capabilities' ;
10
+ import { ICommandDetectionCapability , TerminalCapability , ITerminalCommand , IHandleCommandOptions , ICommandInvalidationRequest , CommandInvalidationReason , ISerializedCommand , ISerializedCommandDetectionCapability , ITerminalOutputMatcher } from 'vs/platform/terminal/common/capabilities/capabilities' ;
11
11
12
12
// Importing types is safe in any layer
13
13
// eslint-disable-next-line local/code-import-patterns
@@ -490,7 +490,7 @@ export class CommandDetectionCapability implements ICommandDetectionCapability {
490
490
commandStartLineContent : this . _currentCommand . commandStartLineContent ,
491
491
hasOutput : ( ) => ! executedMarker ?. isDisposed && ! endMarker ?. isDisposed && ! ! ( executedMarker && endMarker && executedMarker ?. line < endMarker ! . line ) ,
492
492
getOutput : ( ) => getOutputForCommand ( executedMarker , endMarker , buffer ) ,
493
- getOutputMatch : ( outputMatcher : { lineMatcher : string | RegExp ; anchor ?: 'top' | 'bottom' ; offset ?: number ; length ?: number } ) => getOutputMatchForCommand ( executedMarker , endMarker , buffer , this . _terminal . cols , outputMatcher ) ,
493
+ getOutputMatch : ( outputMatcher : ITerminalOutputMatcher ) => getOutputMatchForCommand ( executedMarker , endMarker , buffer , this . _terminal . cols , outputMatcher ) ,
494
494
markProperties : options ?. markProperties
495
495
} ;
496
496
this . _commands . push ( newCommand ) ;
@@ -615,7 +615,7 @@ export class CommandDetectionCapability implements ICommandDetectionCapability {
615
615
exitCode : e . exitCode ,
616
616
hasOutput : ( ) => ! executedMarker ?. isDisposed && ! endMarker ?. isDisposed && ! ! ( executedMarker && endMarker && executedMarker . line < endMarker . line ) ,
617
617
getOutput : ( ) => getOutputForCommand ( executedMarker , endMarker , buffer ) ,
618
- getOutputMatch : ( outputMatcher : { lineMatcher : string | RegExp ; anchor ?: 'top' | 'bottom' ; offset ?: number ; length ?: number } ) => getOutputMatchForCommand ( executedMarker , endMarker , buffer , this . _terminal . cols , outputMatcher ) ,
618
+ getOutputMatch : ( outputMatcher : ITerminalOutputMatcher ) => getOutputMatchForCommand ( executedMarker , endMarker , buffer , this . _terminal . cols , outputMatcher ) ,
619
619
markProperties : e . markProperties
620
620
} ;
621
621
this . _commands . push ( newCommand ) ;
@@ -647,21 +647,17 @@ function getOutputForCommand(executedMarker: IMarker | undefined, endMarker: IMa
647
647
return output === '' ? undefined : output ;
648
648
}
649
649
650
- export function getOutputMatchForCommand ( executedMarker : IMarker | undefined , endMarker : IMarker | undefined , buffer : IBuffer , cols : number , outputMatcher : { lineMatcher : string | RegExp ; anchor ?: 'top' | 'bottom' ; offset ?: number ; length ?: number } ) : RegExpMatchArray | undefined {
650
+ export function getOutputMatchForCommand ( executedMarker : IMarker | undefined , endMarker : IMarker | undefined , buffer : IBuffer , cols : number , outputMatcher : ITerminalOutputMatcher ) : RegExpMatchArray | undefined {
651
651
if ( ! executedMarker || ! endMarker ) {
652
652
return undefined ;
653
653
}
654
654
const startLine = executedMarker . line ;
655
655
const endLine = endMarker . line ;
656
656
657
- if ( startLine === endLine ) {
658
- return undefined ;
659
- }
660
-
661
657
const matcher = outputMatcher . lineMatcher ;
662
658
const linesToCheck = typeof matcher === 'string' ? 1 : countNewLines ( matcher ) ;
663
659
const lines : string [ ] = [ ] ;
664
- if ( outputMatcher ? .anchor === 'bottom' ) {
660
+ if ( outputMatcher . anchor === 'bottom' ) {
665
661
for ( let i = endLine - ( outputMatcher . offset || 0 ) ; i >= startLine ; i -- ) {
666
662
let wrappedLineStart = i ;
667
663
const wrappedLineEnd = i ;
0 commit comments