@@ -523,17 +523,17 @@ module FourSlash {
523
523
}
524
524
}
525
525
526
- public verifyMemberListContains ( symbol : string , type ?: string , docComment ?: string , fullSymbolName ?: string , kind ?: string ) {
526
+ public verifyMemberListContains ( symbol : string , text ?: string , documentation ?: string , kind ?: string ) {
527
527
this . scenarioActions . push ( '<ShowCompletionList />' ) ;
528
528
this . scenarioActions . push ( '<VerifyCompletionContainsItem ItemName="' + symbol + '"/>' ) ;
529
529
530
- if ( type || docComment || fullSymbolName || kind ) {
530
+ if ( text || documentation || kind ) {
531
531
this . taoInvalidReason = 'verifyMemberListContains only supports the "symbol" parameter' ;
532
532
}
533
533
534
534
var members = this . getMemberListAtCaret ( ) ;
535
535
if ( members ) {
536
- this . assertItemInCompletionList ( members . entries , symbol , type , docComment , fullSymbolName , kind ) ;
536
+ this . assertItemInCompletionList ( members . entries , symbol , text , documentation , kind ) ;
537
537
}
538
538
else {
539
539
this . raiseError ( "Expected a member list, but none was provided" ) ;
@@ -632,9 +632,9 @@ module FourSlash {
632
632
}
633
633
}
634
634
635
- public verifyCompletionListContains ( symbol : string , type ?: string , docComment ?: string , fullSymbolName ?: string , kind ?: string ) {
635
+ public verifyCompletionListContains ( symbol : string , text ?: string , documentation ?: string , kind ?: string ) {
636
636
var completions = this . getCompletionListAtCaret ( ) ;
637
- this . assertItemInCompletionList ( completions . entries , symbol , type , docComment , fullSymbolName , kind ) ;
637
+ this . assertItemInCompletionList ( completions . entries , symbol , text , documentation , kind ) ;
638
638
}
639
639
640
640
public verifyCompletionListDoesNotContain ( symbol : string ) {
@@ -647,19 +647,15 @@ module FourSlash {
647
647
}
648
648
}
649
649
650
- public verifyCompletionEntryDetails ( entryName : string , type : string , docComment ?: string , fullSymbolName ?: string , kind ?: string ) {
650
+ public verifyCompletionEntryDetails ( entryName : string , expectedText : string , expectedDocumentation ?: string , kind ?: string ) {
651
651
this . taoInvalidReason = 'verifyCompletionEntryDetails NYI' ;
652
652
653
653
var details = this . getCompletionEntryDetails ( entryName ) ;
654
654
655
- assert . equal ( details . type , type ) ;
655
+ assert . equal ( ts . displayPartsToString ( details . displayParts ) , expectedText ) ;
656
656
657
- if ( docComment != undefined ) {
658
- assert . equal ( details . docComment , docComment ) ;
659
- }
660
-
661
- if ( fullSymbolName !== undefined ) {
662
- assert . equal ( details . fullSymbolName , fullSymbolName ) ;
657
+ if ( expectedDocumentation != undefined ) {
658
+ assert . equal ( ts . displayPartsToString ( details . documentation ) , expectedDocumentation ) ;
663
659
}
664
660
665
661
if ( kind !== undefined ) {
@@ -758,57 +754,43 @@ module FourSlash {
758
754
return this . languageService . getImplementorsAtPosition ( this . activeFile . fileName , this . currentCaretPosition ) ;
759
755
}
760
756
761
- public verifyQuickInfo ( negative : boolean , expectedTypeName ?: string , docComment ?: string , symbolName ?: string , kind ?: string ) {
762
- [ expectedTypeName , docComment , symbolName , kind ] . forEach ( str => {
757
+ public verifyQuickInfo ( negative : boolean , expectedText ?: string , expectedDocumentation ?: string ) {
758
+ [ expectedText , expectedDocumentation ] . forEach ( str => {
763
759
if ( str ) {
764
760
this . scenarioActions . push ( '<ShowQuickInfo />' ) ;
765
761
this . scenarioActions . push ( '<VerifyQuickInfoTextContains IgnoreSpacing="true" Text="' + escapeXmlAttributeValue ( str ) + '" ' + ( negative ? 'ExpectsFailure="true"' : '' ) + ' />' ) ;
766
762
}
767
763
} ) ;
768
764
769
- var actualQuickInfo = this . languageService . getTypeAtPosition ( this . activeFile . fileName , this . currentCaretPosition ) ;
770
- var actualQuickInfoMemberName = actualQuickInfo ? actualQuickInfo . memberName . toString ( ) : "" ;
771
- var actualQuickInfoDocComment = actualQuickInfo ? actualQuickInfo . docComment : "" ;
772
- var actualQuickInfoSymbolName = actualQuickInfo ? actualQuickInfo . fullSymbolName : "" ;
773
- var actualQuickInfoKind = actualQuickInfo ? actualQuickInfo . kind : "" ;
765
+ var actualQuickInfo = this . languageService . getQuickInfoAtPosition ( this . activeFile . fileName , this . currentCaretPosition ) ;
766
+ var actualQuickInfoText = actualQuickInfo ? ts . displayPartsToString ( actualQuickInfo . displayParts ) : "" ;
767
+ var actualQuickInfoDocumentation = actualQuickInfo ? ts . displayPartsToString ( actualQuickInfo . documentation ) : "" ;
774
768
775
769
function assertionMessage ( msg : string ) {
776
770
return "\nMarker: " + currentTestState . lastKnownMarker + "\nChecking: " + msg + "\n\n" ;
777
771
}
778
772
779
773
if ( negative ) {
780
- if ( expectedTypeName !== undefined ) {
781
- assert . notEqual ( actualQuickInfoMemberName , expectedTypeName , assertionMessage ( "quick info member name" ) ) ;
782
- }
783
- if ( docComment != undefined ) {
784
- assert . notEqual ( actualQuickInfoDocComment , docComment , assertionMessage ( "quick info doc comment" ) ) ;
785
- }
786
- if ( symbolName !== undefined ) {
787
- assert . notEqual ( actualQuickInfoSymbolName , symbolName , assertionMessage ( "quick info symbol name" ) ) ;
774
+ if ( expectedText !== undefined ) {
775
+ assert . notEqual ( actualQuickInfoText , expectedText , assertionMessage ( "quick info text" ) ) ;
788
776
}
789
- if ( kind != = undefined ) {
790
- assert . notEqual ( actualQuickInfoKind , kind , assertionMessage ( "quick info kind " ) ) ;
777
+ if ( expectedDocumentation ! = undefined ) {
778
+ assert . notEqual ( actualQuickInfoDocumentation , expectedDocumentation , assertionMessage ( "quick info doc comment " ) ) ;
791
779
}
792
780
} else {
793
- if ( expectedTypeName !== undefined ) {
794
- assert . equal ( actualQuickInfoMemberName , expectedTypeName , assertionMessage ( "quick info member " ) ) ;
781
+ if ( expectedText !== undefined ) {
782
+ assert . equal ( actualQuickInfoText , expectedText , assertionMessage ( "quick info text " ) ) ;
795
783
}
796
- if ( docComment != undefined ) {
797
- assert . equal ( actualQuickInfoDocComment , docComment , assertionMessage ( "quick info doc" ) ) ;
798
- }
799
- if ( symbolName !== undefined ) {
800
- assert . equal ( actualQuickInfoSymbolName , symbolName , assertionMessage ( "quick info symbol name" ) ) ;
801
- }
802
- if ( kind !== undefined ) {
803
- assert . equal ( actualQuickInfoKind , kind , assertionMessage ( "quick info kind" ) ) ;
784
+ if ( expectedDocumentation != undefined ) {
785
+ assert . equal ( actualQuickInfoDocumentation , expectedDocumentation , assertionMessage ( "quick info doc" ) ) ;
804
786
}
805
787
}
806
788
}
807
789
808
790
public verifyQuickInfoExists ( negative : number ) {
809
791
this . taoInvalidReason = 'verifyQuickInfoExists NYI' ;
810
792
811
- var actualQuickInfo = this . languageService . getTypeAtPosition ( this . activeFile . fileName , this . currentCaretPosition ) ;
793
+ var actualQuickInfo = this . languageService . getQuickInfoAtPosition ( this . activeFile . fileName , this . currentCaretPosition ) ;
812
794
if ( negative ) {
813
795
if ( actualQuickInfo ) {
814
796
this . raiseError ( 'verifyQuickInfoExists failed. Expected quick info NOT to exist' ) ;
@@ -826,9 +808,9 @@ module FourSlash {
826
808
827
809
var help = this . getActiveSignatureHelpItem ( ) ;
828
810
assert . equal (
829
- ts . SymbolDisplayPart . toString ( help . prefixDisplayParts ) +
830
- help . parameters . map ( p => ts . SymbolDisplayPart . toString ( p . displayParts ) ) . join ( ts . SymbolDisplayPart . toString ( help . separatorDisplayParts ) ) +
831
- ts . SymbolDisplayPart . toString ( help . suffixDisplayParts ) , expected ) ;
811
+ ts . displayPartsToString ( help . prefixDisplayParts ) +
812
+ help . parameters . map ( p => ts . displayPartsToString ( p . displayParts ) ) . join ( ts . displayPartsToString ( help . separatorDisplayParts ) ) +
813
+ ts . displayPartsToString ( help . suffixDisplayParts ) , expected ) ;
832
814
}
833
815
834
816
public verifyCurrentParameterIsVariable ( isVariable : boolean ) {
@@ -852,7 +834,7 @@ module FourSlash {
852
834
853
835
var activeSignature = this . getActiveSignatureHelpItem ( ) ;
854
836
var activeParameter = this . getActiveParameter ( ) ;
855
- assert . equal ( ts . SymbolDisplayPart . toString ( activeParameter . displayParts ) , parameter ) ;
837
+ assert . equal ( ts . displayPartsToString ( activeParameter . displayParts ) , parameter ) ;
856
838
}
857
839
858
840
public verifyCurrentParameterHelpDocComment ( docComment : string ) {
@@ -1054,7 +1036,7 @@ module FourSlash {
1054
1036
}
1055
1037
1056
1038
public printCurrentQuickInfo ( ) {
1057
- var quickInfo = this . languageService . getTypeAtPosition ( this . activeFile . fileName , this . currentCaretPosition ) ;
1039
+ var quickInfo = this . languageService . getQuickInfoAtPosition ( this . activeFile . fileName , this . currentCaretPosition ) ;
1058
1040
Harness . IO . log ( JSON . stringify ( quickInfo ) ) ;
1059
1041
}
1060
1042
@@ -1710,15 +1692,15 @@ module FourSlash {
1710
1692
}
1711
1693
1712
1694
for ( i = 0 ; i < positions . length ; i ++ ) {
1713
- var nameOf = ( type : ts . TypeInfo ) => type ? type . fullSymbolName : '(none)' ;
1695
+ var nameOf = ( type : ts . QuickInfo ) => type ? ts . displayPartsToString ( type . displayParts ) : '(none)' ;
1714
1696
1715
1697
var pullName : string , refName : string ;
1716
1698
var anyFailed = false ;
1717
1699
1718
1700
var errMsg = '' ;
1719
1701
1720
1702
try {
1721
- var pullType = this . languageService . getTypeAtPosition ( this . activeFile . fileName , positions [ i ] ) ;
1703
+ var pullType = this . languageService . getQuickInfoAtPosition ( this . activeFile . fileName , positions [ i ] ) ;
1722
1704
pullName = nameOf ( pullType ) ;
1723
1705
} catch ( err1 ) {
1724
1706
errMsg = 'Failed to get pull type check. Exception: ' + err1 + '\r\n' ;
@@ -1728,7 +1710,7 @@ module FourSlash {
1728
1710
}
1729
1711
1730
1712
try {
1731
- var referenceType = referenceLanguageService . getTypeAtPosition ( this . activeFile . fileName , positions [ i ] ) ;
1713
+ var referenceType = referenceLanguageService . getQuickInfoAtPosition ( this . activeFile . fileName , positions [ i ] ) ;
1732
1714
refName = nameOf ( referenceType ) ;
1733
1715
} catch ( err2 ) {
1734
1716
errMsg = 'Failed to get full type check. Exception: ' + err2 + '\r\n' ;
@@ -1980,28 +1962,25 @@ module FourSlash {
1980
1962
return result ;
1981
1963
}
1982
1964
1983
- private assertItemInCompletionList ( items : ts . CompletionEntry [ ] , name : string , type ?: string , docComment ?: string , fullSymbolName ?: string , kind ?: string ) {
1965
+ private assertItemInCompletionList ( items : ts . CompletionEntry [ ] , name : string , text ?: string , documentation ?: string , kind ?: string ) {
1984
1966
this . scenarioActions . push ( '<ShowCompletionList />' ) ;
1985
1967
this . scenarioActions . push ( '<VerifyCompletionContainsItem ItemName="' + name + '"/>' ) ;
1986
1968
1987
- if ( type || docComment || fullSymbolName || kind ) {
1969
+ if ( text || documentation || kind ) {
1988
1970
this . taoInvalidReason = 'assertItemInCompletionList only supports the "name" parameter' ;
1989
1971
}
1990
1972
1991
1973
for ( var i = 0 ; i < items . length ; i ++ ) {
1992
1974
var item = items [ i ] ;
1993
1975
if ( item . name == name ) {
1994
- if ( docComment != undefined || type !== undefined || fullSymbolName !== undefined ) {
1976
+ if ( documentation != undefined || text !== undefined ) {
1995
1977
var details = this . getCompletionEntryDetails ( item . name ) ;
1996
1978
1997
- if ( docComment != undefined ) {
1998
- assert . equal ( details . docComment , docComment ) ;
1999
- }
2000
- if ( type !== undefined ) {
2001
- assert . equal ( details . type , type ) ;
1979
+ if ( documentation != undefined ) {
1980
+ assert . equal ( ts . displayPartsToString ( details . documentation ) , documentation ) ;
2002
1981
}
2003
- if ( fullSymbolName !== undefined ) {
2004
- assert . equal ( details . fullSymbolName , fullSymbolName ) ;
1982
+ if ( text !== undefined ) {
1983
+ assert . equal ( ts . displayPartsToString ( details . displayParts ) , text ) ;
2005
1984
}
2006
1985
}
2007
1986
@@ -2015,7 +1994,7 @@ module FourSlash {
2015
1994
2016
1995
var itemsString = items . map ( ( item ) => JSON . stringify ( { name : item . name , kind : item . kind } ) ) . join ( ",\n" ) ;
2017
1996
2018
- this . raiseError ( 'Expected "' + JSON . stringify ( { name : name , type : type , docComment : docComment , fullSymbolName : fullSymbolName , kind : kind } ) + '" to be in list [' + itemsString + ']' ) ;
1997
+ this . raiseError ( 'Expected "' + JSON . stringify ( { name : name , text : text , documentation : documentation , kind : kind } ) + '" to be in list [' + itemsString + ']' ) ;
2019
1998
}
2020
1999
2021
2000
private findFile ( indexOrName : any ) {
0 commit comments