Skip to content

Commit b0d2b71

Browse files
committed
Shortcut the range property
1 parent 6db17ed commit b0d2b71

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

server/src/capabilities/capabilities.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,10 @@ export class ScopeItemCapability {
266266
return result === '' ? 'NONE' : result;
267267
}
268268

269+
get range(): Range | undefined {
270+
return this.element?.context.range;
271+
}
272+
269273
// Item Properties
270274
locationUri?: string;
271275
isPublicScope?: boolean;
@@ -904,7 +908,7 @@ export class ScopeItemCapability {
904908

905909
// Check all items for whether they have a name overlap or a scope overlap.
906910
scope?.maps.forEach(map => map.forEach(items => items.forEach(item => {
907-
const elementRange = item.element?.context.range;
911+
const elementRange = item.range;
908912
const identifierRange = item.element?.identifierCapability?.range;
909913
if (identifierRange && isPositionInsideRange(position, identifierRange)) {
910914
// Position is inside the identifier, push to results.
@@ -976,7 +980,7 @@ export class ScopeItemCapability {
976980
link.locationUri,
977981
link.element.context.range,
978982
link.element.identifierCapability.range,
979-
this.element?.context.range
983+
this.range
980984
);
981985
}
982986

@@ -1049,7 +1053,7 @@ export class ScopeItemCapability {
10491053
};
10501054

10511055
const m = new Map<string, ScopeItemCapability>();
1052-
results.forEach(s => m.set(rangeString(s.element?.context.range), s));
1056+
results.forEach(s => m.set(rangeString(s.range), s));
10531057
return Array.from(m.values());
10541058
}
10551059
}

0 commit comments

Comments
 (0)