Beginning special casing for getOccurrencesAtPosition.

This commit is contained in:
Daniel Rosenwasser
2014-08-26 11:44:30 -07:00
parent e851e4b00b
commit 5d15cd22b1
+19 -8
View File
@@ -1933,7 +1933,9 @@ module ts {
current = child;
continue outer;
}
if (child.end > position) break;
if (child.end > position) {
break;
}
}
return current;
}
@@ -2160,13 +2162,22 @@ module ts {
return undefined;
}
if (node.kind !== SyntaxKind.Identifier &&
!isLiteralNameOfPropertyDeclarationOrIndexAccess(node) &&
!isNameOfExternalModuleImportOrDeclaration(node)) {
return undefined;
if (node.kind === SyntaxKind.Identifier ||
isLiteralNameOfPropertyDeclarationOrIndexAccess(node) ||
isNameOfExternalModuleImportOrDeclaration(node)) {
return getReferencesForNode(node, [sourceFile]);
}
return getReferencesForNode(node, [sourceFile]);
switch (node.kind) {
}
return undefined;
function keywordsToReferenceEntries(keywords: Node[]): ReferenceEntry[]{
return keywords.map(keyword =>
new ReferenceEntry(filename, TypeScript.TextSpan.fromBounds(keyword.getStart(), keyword.end), /* isWriteAccess */ false)
);
}
}
function getReferencesAtPosition(filename: string, position: number): ReferenceEntry[] {
@@ -2284,13 +2295,13 @@ module ts {
var container = getContainerNode(declarations[i]);
if (scope && scope !== container) {
// Diffrent declarations have diffrent containers, bail out
// Different declarations have different containers, bail out
return undefined;
}
if (container.kind === SyntaxKind.SourceFile && !isExternalModule(<SourceFile>container)) {
// This is a global variable and not an external module, any declaration defined
// withen this scope is visible outside the file
// within this scope is visible outside the file
return undefined;
}