@@ -53,6 +53,7 @@ import {
53
53
formatting ,
54
54
getDeclarationFromName ,
55
55
getDeclarationOfKind ,
56
+ getDocumentSpansEqualityComparer ,
56
57
getEmitDeclarations ,
57
58
getEntrypointsFromPackageJsonInfo ,
58
59
getLineAndCharacterOfPosition ,
@@ -498,8 +499,8 @@ interface ProjectNavigateToItems {
498
499
navigateToItems : readonly NavigateToItem [ ] ;
499
500
}
500
501
501
- function createDocumentSpanSet ( ) : Set < DocumentSpan > {
502
- return createSet ( ( { textSpan } ) => textSpan . start + 100003 * textSpan . length , documentSpansEqual ) ;
502
+ function createDocumentSpanSet ( useCaseSensitiveFileNames : boolean ) : Set < DocumentSpan > {
503
+ return createSet ( ( { textSpan } ) => textSpan . start + 100003 * textSpan . length , getDocumentSpansEqualityComparer ( useCaseSensitiveFileNames ) ) ;
503
504
}
504
505
505
506
function getRenameLocationsWorker (
@@ -509,6 +510,7 @@ function getRenameLocationsWorker(
509
510
findInStrings : boolean ,
510
511
findInComments : boolean ,
511
512
preferences : protocol . UserPreferences ,
513
+ useCaseSensitiveFileNames : boolean ,
512
514
) : readonly RenameLocation [ ] {
513
515
const perProjectResults = getPerProjectReferences (
514
516
projects ,
@@ -525,7 +527,7 @@ function getRenameLocationsWorker(
525
527
}
526
528
527
529
const results : RenameLocation [ ] = [ ] ;
528
- const seen = createDocumentSpanSet ( ) ;
530
+ const seen = createDocumentSpanSet ( useCaseSensitiveFileNames ) ;
529
531
530
532
perProjectResults . forEach ( ( projectResults , project ) => {
531
533
for ( const result of projectResults ) {
@@ -552,6 +554,7 @@ function getReferencesWorker(
552
554
projects : Projects ,
553
555
defaultProject : Project ,
554
556
initialLocation : DocumentPosition ,
557
+ useCaseSensitiveFileNames : boolean ,
555
558
logger : Logger ,
556
559
) : readonly ReferencedSymbol [ ] {
557
560
const perProjectResults = getPerProjectReferences (
@@ -593,7 +596,7 @@ function getReferencesWorker(
593
596
}
594
597
else {
595
598
// Correct isDefinition properties from projects other than defaultProject
596
- const knownSymbolSpans = createDocumentSpanSet ( ) ;
599
+ const knownSymbolSpans = createDocumentSpanSet ( useCaseSensitiveFileNames ) ;
597
600
for ( const referencedSymbol of defaultProjectResults ) {
598
601
for ( const ref of referencedSymbol . references ) {
599
602
if ( ref . isDefinition ) {
@@ -632,7 +635,7 @@ function getReferencesWorker(
632
635
// of each definition and merging references from all the projects where they appear.
633
636
634
637
const results : ReferencedSymbol [ ] = [ ] ;
635
- const seenRefs = createDocumentSpanSet ( ) ; // It doesn't make sense to have a reference in two definition lists, so we de-dup globally
638
+ const seenRefs = createDocumentSpanSet ( useCaseSensitiveFileNames ) ; // It doesn't make sense to have a reference in two definition lists, so we de-dup globally
636
639
637
640
// TODO: We might end up with a more logical allocation of refs to defs if we pre-sorted the defs by descending ref-count.
638
641
// Otherwise, it just ends up attached to the first corresponding def we happen to process. The others may or may not be
@@ -649,7 +652,7 @@ function getReferencesWorker(
649
652
contextSpan : getMappedContextSpanForProject ( referencedSymbol . definition , project ) ,
650
653
} ;
651
654
652
- let symbolToAddTo = find ( results , o => documentSpansEqual ( o . definition , definition ) ) ;
655
+ let symbolToAddTo = find ( results , o => documentSpansEqual ( o . definition , definition , useCaseSensitiveFileNames ) ) ;
653
656
if ( ! symbolToAddTo ) {
654
657
symbolToAddTo = { definition, references : [ ] } ;
655
658
results . push ( symbolToAddTo ) ;
@@ -1542,7 +1545,10 @@ export class Session<TMessage = string> implements EventSender {
1542
1545
) ;
1543
1546
1544
1547
if ( needsJsResolution ) {
1545
- const definitionSet = createSet < DefinitionInfo > ( d => d . textSpan . start , documentSpansEqual ) ;
1548
+ const definitionSet = createSet < DefinitionInfo > (
1549
+ d => d . textSpan . start ,
1550
+ getDocumentSpansEqualityComparer ( this . host . useCaseSensitiveFileNames ) ,
1551
+ ) ;
1546
1552
definitions ?. forEach ( d => definitionSet . add ( d ) ) ;
1547
1553
const noDtsProject = project . getNoDtsResolutionProject ( file ) ;
1548
1554
const ls = noDtsProject . getLanguageService ( ) ;
@@ -1993,6 +1999,7 @@ export class Session<TMessage = string> implements EventSender {
1993
1999
! ! args . findInStrings ,
1994
2000
! ! args . findInComments ,
1995
2001
preferences ,
2002
+ this . host . useCaseSensitiveFileNames ,
1996
2003
) ;
1997
2004
if ( ! simplifiedResult ) return locations ;
1998
2005
return { info : renameInfo , locs : this . toSpanGroups ( locations ) } ;
@@ -2029,6 +2036,7 @@ export class Session<TMessage = string> implements EventSender {
2029
2036
projects ,
2030
2037
this . getDefaultProject ( args ) ,
2031
2038
{ fileName : args . file , pos : position } ,
2039
+ this . host . useCaseSensitiveFileNames ,
2032
2040
this . logger ,
2033
2041
) ;
2034
2042
@@ -2054,7 +2062,7 @@ export class Session<TMessage = string> implements EventSender {
2054
2062
const preferences = this . getPreferences ( toNormalizedPath ( fileName ) ) ;
2055
2063
2056
2064
const references : ReferenceEntry [ ] = [ ] ;
2057
- const seen = createDocumentSpanSet ( ) ;
2065
+ const seen = createDocumentSpanSet ( this . host . useCaseSensitiveFileNames ) ;
2058
2066
2059
2067
forEachProjectInProjects ( projects , /*path*/ undefined , project => {
2060
2068
if ( project . getCancellationToken ( ) . isCancellationRequested ( ) ) return ;
0 commit comments