@@ -873,37 +873,34 @@ namespace FourSlash {
873873 * @param spanIndex the index of the range that the completion item's replacement text span should match
874874 */
875875 public verifyCompletionListDoesNotContain ( entryId : ts . Completions . CompletionEntryIdentifier , expectedText ?: string , expectedDocumentation ?: string , expectedKind ?: string , spanIndex ?: number ) {
876- const that = this ;
877876 let replacementSpan : ts . TextSpan ;
878877 if ( spanIndex !== undefined ) {
879878 replacementSpan = this . getTextSpanForRangeAtIndex ( spanIndex ) ;
880879 }
881880
882- function filterByTextOrDocumentation ( entry : ts . CompletionEntry ) {
883- const details = that . getCompletionEntryDetails ( entry . name ) ;
884- const documentation = details && ts . displayPartsToString ( details . documentation ) ;
885- const text = details && ts . displayPartsToString ( details . displayParts ) ;
886-
887- // If any of the expected values are undefined, assume that users don't
888- // care about them.
889- if ( replacementSpan && ! TestState . textSpansEqual ( replacementSpan , entry . replacementSpan ) ) {
890- return false ;
891- }
892- else if ( expectedText && text !== expectedText ) {
893- return false ;
894- }
895- else if ( expectedDocumentation && documentation !== expectedDocumentation ) {
896- return false ;
897- }
898-
899- return true ;
900- }
901-
902881 const completions = this . getCompletionListAtCaret ( ) ;
903882 if ( completions ) {
904883 let filterCompletions = completions . entries . filter ( e => e . name === entryId . name && e . source === entryId . source ) ;
905884 filterCompletions = expectedKind ? filterCompletions . filter ( e => e . kind === expectedKind ) : filterCompletions ;
906- filterCompletions = filterCompletions . filter ( filterByTextOrDocumentation ) ;
885+ filterCompletions = filterCompletions . filter ( entry => {
886+ const details = this . getCompletionEntryDetails ( entry . name ) ;
887+ const documentation = details && ts . displayPartsToString ( details . documentation ) ;
888+ const text = details && ts . displayPartsToString ( details . displayParts ) ;
889+
890+ // If any of the expected values are undefined, assume that users don't
891+ // care about them.
892+ if ( replacementSpan && ! TestState . textSpansEqual ( replacementSpan , entry . replacementSpan ) ) {
893+ return false ;
894+ }
895+ else if ( expectedText && text !== expectedText ) {
896+ return false ;
897+ }
898+ else if ( expectedDocumentation && documentation !== expectedDocumentation ) {
899+ return false ;
900+ }
901+
902+ return true ;
903+ } ) ;
907904 if ( filterCompletions . length !== 0 ) {
908905 // After filtered using all present criterion, if there are still symbol left in the list
909906 // then these symbols must meet the criterion for Not supposed to be in the list. So we
0 commit comments