@@ -42,6 +42,7 @@ namespace FourSlash {
42
42
* is a range with `text in range` "selected".
43
43
*/
44
44
ranges : Range [ ] ;
45
+ rangesByText ?: ts . MultiMap < Range > ;
45
46
}
46
47
47
48
export interface Marker {
@@ -1002,7 +1003,7 @@ namespace FourSlash {
1002
1003
}
1003
1004
1004
1005
public verifySingleReferenceGroup ( definition : FourSlashInterface . ReferenceGroupDefinition , ranges ?: Range [ ] | string ) {
1005
- ranges = ts . isString ( ranges ) ? this . rangesByText ( ) . get ( ranges ) ! : ranges || this . getRanges ( ) ;
1006
+ ranges = ts . isString ( ranges ) ? this . rangesByText ( ) . get ( ranges ) ! : ranges || this . getRanges ( ) ;
1006
1007
this . verifyReferenceGroups ( ranges , [ { definition, ranges } ] ) ;
1007
1008
}
1008
1009
@@ -1853,6 +1854,7 @@ Actual: ${stringify(fullActual)}`);
1853
1854
range . end = updatePosition ( range . end , editStart , editEnd , newText ) ;
1854
1855
}
1855
1856
}
1857
+ this . testData . rangesByText = undefined ;
1856
1858
}
1857
1859
1858
1860
private removeWhitespace ( text : string ) : string {
@@ -2035,7 +2037,9 @@ Actual: ${stringify(fullActual)}`);
2035
2037
}
2036
2038
2037
2039
public rangesByText ( ) : ts . Map < Range [ ] > {
2040
+ if ( this . testData . rangesByText ) return this . testData . rangesByText ;
2038
2041
const result = ts . createMultiMap < Range > ( ) ;
2042
+ this . testData . rangesByText = result ;
2039
2043
for ( const range of this . getRanges ( ) ) {
2040
2044
const text = this . rangeText ( range ) ;
2041
2045
result . add ( text , range ) ;
0 commit comments