@@ -1603,7 +1603,7 @@ module ts {
1603
1603
function getCompletionEntriesFromSymbols ( symbols : Symbol [ ] , session : CompletionSession ) : void {
1604
1604
forEach ( symbols , ( symbol ) => {
1605
1605
var entry = createCompletionEntry ( symbol ) ;
1606
- if ( entry ) {
1606
+ if ( entry && ! lookUp ( session . symbols , entry . name ) ) {
1607
1607
session . entries . push ( entry ) ;
1608
1608
session . symbols [ entry . name ] = symbol ;
1609
1609
}
@@ -1737,6 +1737,11 @@ module ts {
1737
1737
return ( SyntaxKind . FirstPunctuation <= kind && kind <= SyntaxKind . LastPunctuation ) ;
1738
1738
}
1739
1739
1740
+ function isVisibleWithenDeclaration ( symbol : Symbol , containingClass : Declaration ) : boolean {
1741
+ var declaration = symbol . declarations && symbol . declarations [ 0 ] ;
1742
+ return ! ( declaration && declaration . flags & NodeFlags . Private && containingClass !== declaration . parent ) ;
1743
+ }
1744
+
1740
1745
synchronizeHostData ( ) ;
1741
1746
1742
1747
filename = TypeScript . switchToForwardSlashes ( filename ) ;
@@ -1809,24 +1814,34 @@ module ts {
1809
1814
1810
1815
// Right of dot member completion list
1811
1816
if ( isRightOfDot ) {
1817
+ var symbols : Symbol [ ] = [ ] ;
1818
+ var containingClass = getAncestor ( mappedNode , SyntaxKind . ClassDeclaration ) ;
1819
+ isMemberCompletion = true ;
1820
+
1821
+
1822
+ if ( mappedNode . kind === SyntaxKind . Identifier || mappedNode . kind === SyntaxKind . QualifiedName || mappedNode . kind === SyntaxKind . PropertyAccess ) {
1823
+ var symbol = typeInfoResolver . getSymbolInfo ( mappedNode ) ;
1824
+ if ( symbol && symbol . flags & SymbolFlags . HasExports ) {
1825
+ // Extract module or enum members
1826
+ forEachValue ( symbol . exports , symbol => {
1827
+ if ( isVisibleWithenDeclaration ( symbol , containingClass ) ) {
1828
+ symbols . push ( symbol ) ;
1829
+ }
1830
+ } ) ;
1831
+ }
1832
+ }
1833
+
1812
1834
var type = typeInfoResolver . getTypeOfNode ( mappedNode ) ;
1813
1835
var apparentType : ApparentType = type && typeInfoResolver . getApparentType ( type ) ;
1814
- if ( ! apparentType ) {
1815
- return undefined ;
1836
+ if ( apparentType ) {
1837
+ // Filter private properties
1838
+ forEach ( apparentType . getApparentProperties ( ) , symbol => {
1839
+ if ( isVisibleWithenDeclaration ( symbol , containingClass ) ) {
1840
+ symbols . push ( symbol ) ;
1841
+ }
1842
+ } ) ;
1816
1843
}
1817
1844
1818
- var containingClass = getAncestor ( mappedNode , SyntaxKind . ClassDeclaration ) ;
1819
-
1820
- var symbols : Symbol [ ] = [ ] ;
1821
- // Filter private properties
1822
- forEach ( apparentType . getApparentProperties ( ) , symbol => {
1823
- var declaration = symbol . declarations && symbol . declarations [ 0 ] ;
1824
- if ( declaration && declaration . flags & NodeFlags . Private && containingClass !== declaration . parent )
1825
- return ;
1826
-
1827
- symbols . push ( symbol ) ;
1828
- } ) ;
1829
- isMemberCompletion = true ;
1830
1845
getCompletionEntriesFromSymbols ( symbols , activeCompletionSession ) ;
1831
1846
}
1832
1847
else {
0 commit comments