mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Beginning special casing for getOccurrencesAtPosition.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user