diff --git a/TypeScript b/TypeScript index a531b87..d8ab098 160000 --- a/TypeScript +++ b/TypeScript @@ -1 +1 @@ -Subproject commit a531b87b3c668f56a4140699f89b7fcc4160dfbc +Subproject commit d8ab09819560991807c489f5ac1a391be86d3de6 diff --git a/bin/ntypescript.js b/bin/ntypescript.js index cd814b0..53c9f71 100644 --- a/bin/ntypescript.js +++ b/bin/ntypescript.js @@ -57346,6 +57346,27 @@ var ts; } if (!documentation) { documentation = symbol.getDocumentationComment(); + if (documentation.length === 0 && symbol.flags & 4 /* Property */) { + // For some special property access expressions like `experts.foo = foo` or `module.exports.foo = foo` + // there documentation comments might be attached to the right hand side symbol of their declarations. + // The pattern of such special property access is that the parent symbol is the symbol of the file. + if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 256 /* SourceFile */; })) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + if (!declaration.parent || declaration.parent.kind !== 187 /* BinaryExpression */) { + continue; + } + var rhsSymbol = program.getTypeChecker().getSymbolAtLocation(declaration.parent.right); + if (!rhsSymbol) { + continue; + } + documentation = rhsSymbol.getDocumentationComment(); + if (documentation.length > 0) { + break; + } + } + } + } } return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind }; function addNewLineIfDisplayPartsExist() { diff --git a/bin/typescript.js b/bin/typescript.js index 1b40af3..8cec495 100644 --- a/bin/typescript.js +++ b/bin/typescript.js @@ -57346,6 +57346,27 @@ var ts; } if (!documentation) { documentation = symbol.getDocumentationComment(); + if (documentation.length === 0 && symbol.flags & 4 /* Property */) { + // For some special property access expressions like `experts.foo = foo` or `module.exports.foo = foo` + // there documentation comments might be attached to the right hand side symbol of their declarations. + // The pattern of such special property access is that the parent symbol is the symbol of the file. + if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 256 /* SourceFile */; })) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + if (!declaration.parent || declaration.parent.kind !== 187 /* BinaryExpression */) { + continue; + } + var rhsSymbol = program.getTypeChecker().getSymbolAtLocation(declaration.parent.right); + if (!rhsSymbol) { + continue; + } + documentation = rhsSymbol.getDocumentationComment(); + if (documentation.length > 0) { + break; + } + } + } + } } return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind }; function addNewLineIfDisplayPartsExist() { diff --git a/kicktravis b/kicktravis index 850e3b3..9951cbb 100644 --- a/kicktravis +++ b/kicktravis @@ -1 +1 @@ -2016-08-20 [ci skip] Version: 1.201608200007.1+a531b87b3c668f56a4140699f89b7fcc4160dfbc +2016-08-21 [ci skip] Version: 1.201608210006.1+d8ab09819560991807c489f5ac1a391be86d3de6 diff --git a/package.json b/package.json index 9084eee..be1f475 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ntypescript", - "version": "1.201608200007.1+a531b87b3c668f56a4140699f89b7fcc4160dfbc", + "version": "1.201608210006.1+d8ab09819560991807c489f5ac1a391be86d3de6", "description": "A nicer version of microsoft/typescript packaged and released for API developers", "main": "./bin/ntypescript.js", "bin": { diff --git a/src/services/services.ts b/src/services/services.ts index 9ef1431..d200e08 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -4917,6 +4917,28 @@ namespace ts { if (!documentation) { documentation = symbol.getDocumentationComment(); + if (documentation.length === 0 && symbol.flags & SymbolFlags.Property) { + // For some special property access expressions like `experts.foo = foo` or `module.exports.foo = foo` + // there documentation comments might be attached to the right hand side symbol of their declarations. + // The pattern of such special property access is that the parent symbol is the symbol of the file. + if (symbol.parent && forEach(symbol.parent.declarations, declaration => declaration.kind === SyntaxKind.SourceFile)) { + for (const declaration of symbol.declarations) { + if (!declaration.parent || declaration.parent.kind !== SyntaxKind.BinaryExpression) { + continue; + } + + const rhsSymbol = program.getTypeChecker().getSymbolAtLocation((declaration.parent).right); + if (!rhsSymbol) { + continue; + } + + documentation = rhsSymbol.getDocumentationComment(); + if (documentation.length > 0) { + break; + } + } + } + } } return { displayParts, documentation, symbolKind };