Skip to content

Commit 5d15cd2

Browse files
Beginning special casing for getOccurrencesAtPosition.
1 parent e851e4b commit 5d15cd2

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

src/services/services.ts

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1933,7 +1933,9 @@ module ts {
19331933
current = child;
19341934
continue outer;
19351935
}
1936-
if (child.end > position) break;
1936+
if (child.end > position) {
1937+
break;
1938+
}
19371939
}
19381940
return current;
19391941
}
@@ -2160,13 +2162,22 @@ module ts {
21602162
return undefined;
21612163
}
21622164

2163-
if (node.kind !== SyntaxKind.Identifier &&
2164-
!isLiteralNameOfPropertyDeclarationOrIndexAccess(node) &&
2165-
!isNameOfExternalModuleImportOrDeclaration(node)) {
2166-
return undefined;
2165+
if (node.kind === SyntaxKind.Identifier ||
2166+
isLiteralNameOfPropertyDeclarationOrIndexAccess(node) ||
2167+
isNameOfExternalModuleImportOrDeclaration(node)) {
2168+
return getReferencesForNode(node, [sourceFile]);
21672169
}
21682170

2169-
return getReferencesForNode(node, [sourceFile]);
2171+
switch (node.kind) {
2172+
}
2173+
2174+
return undefined;
2175+
2176+
function keywordsToReferenceEntries(keywords: Node[]): ReferenceEntry[]{
2177+
return keywords.map(keyword =>
2178+
new ReferenceEntry(filename, TypeScript.TextSpan.fromBounds(keyword.getStart(), keyword.end), /* isWriteAccess */ false)
2179+
);
2180+
}
21702181
}
21712182

21722183
function getReferencesAtPosition(filename: string, position: number): ReferenceEntry[] {
@@ -2284,13 +2295,13 @@ module ts {
22842295
var container = getContainerNode(declarations[i]);
22852296

22862297
if (scope && scope !== container) {
2287-
// Diffrent declarations have diffrent containers, bail out
2298+
// Different declarations have different containers, bail out
22882299
return undefined;
22892300
}
22902301

22912302
if (container.kind === SyntaxKind.SourceFile && !isExternalModule(<SourceFile>container)) {
22922303
// This is a global variable and not an external module, any declaration defined
2293-
// withen this scope is visible outside the file
2304+
// within this scope is visible outside the file
22942305
return undefined;
22952306
}
22962307

0 commit comments

Comments
 (0)