@@ -54,23 +54,23 @@ class FindReferencesFeature extends GoToDefinitionFeature {
54
54
55
55
var name = builtin ?? definition.name;
56
56
57
- var candidates = < Reference > [] ;
57
+ var documents = ls.cache. getDocuments () ;
58
58
// Go through all documents with a visitor.
59
59
// For each document, collect candidates that match the definition name.
60
- for (var document in ls.cache. getDocuments () ) {
60
+ for (var document in documents ) {
61
61
var stylesheet = ls.parseStylesheet (document);
62
62
var visitor = FindReferencesVisitor (
63
63
document,
64
64
name,
65
65
includeDeclaration: context.includeDeclaration,
66
66
);
67
67
stylesheet.accept (visitor);
68
- candidates.addAll (visitor.candidates);
69
68
70
69
// Go through all candidates and add matches to references.
71
70
// A match is a candidate with the same name, referenceKind,
72
71
// and whose definition is the same as the definition of the
73
72
// symbol at [position].
73
+ var candidates = visitor.candidates;
74
74
for (var candidate in candidates) {
75
75
if (builtin case var name? ) {
76
76
if (name.contains (candidate.name)) {
@@ -105,7 +105,7 @@ class FindReferencesFeature extends GoToDefinitionFeature {
105
105
// the two definitions are the same, we have a reference.
106
106
var candidateDefinition = await internalGoToDefinition (
107
107
document,
108
- position ,
108
+ candidate.location.range.start ,
109
109
);
110
110
111
111
if (candidateDefinition != null &&
@@ -117,6 +117,8 @@ class FindReferencesFeature extends GoToDefinitionFeature {
117
117
references.add (candidate);
118
118
continue ;
119
119
}
120
+ } else {
121
+ continue ;
120
122
}
121
123
}
122
124
}
0 commit comments