@@ -44,7 +44,8 @@ import { CompletionContext, CompletionList, CompletionProviderRegistry } from 'v
4444import { first } from 'vs/base/common/arrays' ;
4545import { IPanelService } from 'vs/workbench/services/panel/common/panelService' ;
4646import { IAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget' ;
47- import { Variable , Expression , SimpleReplElement , RawObjectReplElement } from 'vs/workbench/contrib/debug/common/debugModel' ;
47+ import { Variable } from 'vs/workbench/contrib/debug/common/debugModel' ;
48+ import { SimpleReplElement , RawObjectReplElement , ReplEvaluationInput , ReplEvaluationResult } from 'vs/workbench/contrib/debug/common/replModel' ;
4849import { IListVirtualDelegate } from 'vs/base/browser/ui/list/list' ;
4950import { ITreeRenderer , ITreeNode , ITreeContextMenuEvent , IAsyncDataSource } from 'vs/base/browser/ui/tree/tree' ;
5051import { IEditorService } from 'vs/workbench/services/editor/common/editorService' ;
@@ -412,7 +413,8 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati
412413 [
413414 this . instantiationService . createInstance ( VariablesRenderer ) ,
414415 this . instantiationService . createInstance ( ReplSimpleElementsRenderer ) ,
415- new ReplExpressionsRenderer ( ) ,
416+ new ReplEvaluationInputsRenderer ( ) ,
417+ new ReplEvaluationResultsRenderer ( ) ,
416418 new ReplRawObjectsRenderer ( )
417419 ] ,
418420 // https://github.com/microsoft/TypeScript/issues/32526
@@ -568,12 +570,13 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati
568570
569571// Repl tree
570572
571- interface IExpressionTemplateData {
572- input : HTMLElement ;
573- output : HTMLElement ;
573+ interface IReplEvaluationInputTemplateData {
574+ label : HighlightedLabel ;
575+ }
576+
577+ interface IReplEvaluationResultTemplateData {
574578 value : HTMLElement ;
575579 annotation : HTMLElement ;
576- label : HighlightedLabel ;
577580}
578581
579582interface ISimpleReplElementTemplateData {
@@ -593,27 +596,46 @@ interface IRawObjectReplTemplateData {
593596 label : HighlightedLabel ;
594597}
595598
596- class ReplExpressionsRenderer implements ITreeRenderer < Expression , FuzzyScore , IExpressionTemplateData > {
597- static readonly ID = 'expressionRepl ' ;
599+ class ReplEvaluationInputsRenderer implements ITreeRenderer < ReplEvaluationInput , FuzzyScore , IReplEvaluationInputTemplateData > {
600+ static readonly ID = 'replEvaluationInput ' ;
598601
599602 get templateId ( ) : string {
600- return ReplExpressionsRenderer . ID ;
603+ return ReplEvaluationInputsRenderer . ID ;
601604 }
602605
603- renderTemplate ( container : HTMLElement ) : IExpressionTemplateData {
604- dom . addClass ( container , 'input-output-pair' ) ;
605- const input = dom . append ( container , $ ( '.input.expression' ) ) ;
606+ renderTemplate ( container : HTMLElement ) : IReplEvaluationInputTemplateData {
607+ const input = dom . append ( container , $ ( '.expression' ) ) ;
606608 const label = new HighlightedLabel ( input , false ) ;
607- const output = dom . append ( container , $ ( '.output.expression' ) ) ;
609+ return { label } ;
610+ }
611+
612+ renderElement ( element : ITreeNode < ReplEvaluationInput , FuzzyScore > , index : number , templateData : IReplEvaluationInputTemplateData ) : void {
613+ const evaluation = element . element ;
614+ templateData . label . set ( evaluation . value , createMatches ( element . filterData ) ) ;
615+ }
616+
617+ disposeTemplate ( templateData : IReplEvaluationInputTemplateData ) : void {
618+ // noop
619+ }
620+ }
621+
622+ class ReplEvaluationResultsRenderer implements ITreeRenderer < ReplEvaluationResult , FuzzyScore , IReplEvaluationResultTemplateData > {
623+ static readonly ID = 'replEvaluationResult' ;
624+
625+ get templateId ( ) : string {
626+ return ReplEvaluationResultsRenderer . ID ;
627+ }
628+
629+ renderTemplate ( container : HTMLElement ) : IReplEvaluationResultTemplateData {
630+ const output = dom . append ( container , $ ( '.evaluation-result.expression' ) ) ;
608631 const value = dom . append ( output , $ ( 'span.value' ) ) ;
609632 const annotation = dom . append ( output , $ ( 'span' ) ) ;
610633
611- return { input , label , output , value, annotation } ;
634+ return { value, annotation } ;
612635 }
613636
614- renderElement ( element : ITreeNode < Expression , FuzzyScore > , index : number , templateData : IExpressionTemplateData ) : void {
637+ renderElement ( element : ITreeNode < ReplEvaluationResult , FuzzyScore > , index : number , templateData : IReplEvaluationResultTemplateData ) : void {
615638 const expression = element . element ;
616- templateData . label . set ( expression . name , createMatches ( element . filterData ) ) ;
617639 renderExpressionValue ( expression , templateData . value , {
618640 preserveWhitespace : ! expression . hasChildren ,
619641 showHover : false ,
@@ -625,7 +647,7 @@ class ReplExpressionsRenderer implements ITreeRenderer<Expression, FuzzyScore, I
625647 }
626648 }
627649
628- disposeTemplate ( templateData : IExpressionTemplateData ) : void {
650+ disposeTemplate ( templateData : IReplEvaluationResultTemplateData ) : void {
629651 // noop
630652 }
631653}
@@ -757,24 +779,23 @@ class ReplDelegate implements IListVirtualDelegate<IReplElement> {
757779 const rowHeight = Math . ceil ( 1.4 * fontSize ) ;
758780 const wordWrap = config . console . wordWrap ;
759781 if ( ! wordWrap ) {
760- return element instanceof Expression ? 2 * rowHeight : rowHeight ;
782+ return rowHeight ;
761783 }
762784
763785 // In order to keep scroll position we need to give a good approximation to the tree
764786 // For every 150 characters increase the number of lines needed
765- if ( element instanceof Expression ) {
766- let { name, value } = element ;
767- let nameRows = countNumberOfLines ( name ) + Math . floor ( name . length / 150 ) ;
787+ if ( element instanceof ReplEvaluationResult ) {
788+ let value = element . value ;
768789
769790 if ( element . hasChildren ) {
770- return ( nameRows + 1 ) * rowHeight ;
791+ return rowHeight ;
771792 }
772793
773794 let valueRows = value ? ( countNumberOfLines ( value ) + Math . floor ( value . length / 150 ) ) : 0 ;
774- return rowHeight * ( nameRows + valueRows ) ;
795+ return rowHeight * valueRows ;
775796 }
776797
777- if ( element instanceof SimpleReplElement ) {
798+ if ( element instanceof SimpleReplElement || element instanceof ReplEvaluationInput ) {
778799 let value = element . value ;
779800 let valueRows = countNumberOfLines ( value ) + Math . floor ( value . length / 150 ) ;
780801
@@ -788,8 +809,11 @@ class ReplDelegate implements IListVirtualDelegate<IReplElement> {
788809 if ( element instanceof Variable && element . name ) {
789810 return VariablesRenderer . ID ;
790811 }
791- if ( element instanceof Expression ) {
792- return ReplExpressionsRenderer . ID ;
812+ if ( element instanceof ReplEvaluationResult ) {
813+ return ReplEvaluationResultsRenderer . ID ;
814+ }
815+ if ( element instanceof ReplEvaluationInput ) {
816+ return ReplEvaluationInputsRenderer . ID ;
793817 }
794818 if ( element instanceof SimpleReplElement || ( element instanceof Variable && ! element . name ) ) {
795819 // Variable with no name is a top level variable which should be rendered like a repl element #17404
@@ -836,10 +860,7 @@ class ReplAccessibilityProvider implements IAccessibilityProvider<IReplElement>
836860 if ( element instanceof Variable ) {
837861 return nls . localize ( 'replVariableAriaLabel' , "Variable {0} has value {1}, read eval print loop, debug" , element . name , element . value ) ;
838862 }
839- if ( element instanceof Expression ) {
840- return nls . localize ( 'replExpressionAriaLabel' , "Expression {0} has value {1}, read eval print loop, debug" , element . name , element . value ) ;
841- }
842- if ( element instanceof SimpleReplElement ) {
863+ if ( element instanceof SimpleReplElement || element instanceof ReplEvaluationInput || element instanceof ReplEvaluationResult ) {
843864 return nls . localize ( 'replValueOutputAriaLabel' , "{0}, read eval print loop, debug" , element . value ) ;
844865 }
845866 if ( element instanceof RawObjectReplElement ) {
0 commit comments