Get the JSDoc comments for the symbols

This also fixed type formatting for single function signatures in the types
This commit is contained in:
Sheetal Nandi 2014-09-11 13:21:27 -07:00
parent f2880ce5b7
commit d1a09da676
5 changed files with 467 additions and 105 deletions

View file

@ -1243,13 +1243,13 @@ module ts {
if (allowFunctionOrConstructorTypeLiteral) {
if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) {
writeSignature(resolved.callSignatures[0], /*arrowStyle*/ true);
writeSignature(resolved.callSignatures[0], shouldTypeBeAllowStyleTypeLiteral());
return;
}
if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) {
writeKeyword(writer, SyntaxKind.NewKeyword);
writeSpace(writer);
writeSignature(resolved.constructSignatures[0], /*arrowStyle*/ true);
writeSignature(resolved.constructSignatures[0], shouldTypeBeAllowStyleTypeLiteral());
return;
}
}
@ -1328,6 +1328,11 @@ module ts {
}
writer.decreaseIndent();
writePunctuation(writer, SyntaxKind.CloseBraceToken);
function shouldTypeBeAllowStyleTypeLiteral() {
return !typeStack || typeStack.length !== 1 || typeStack[0] !== type || // If this is not a top level type we are writing, arrowStyle is ok
!(flags & TypeFormatFlags.NoArrowStyleTopLevelSignature);
}
}
function writeSignature(signature: Signature, arrowStyle?: boolean) {

View file

@ -673,6 +673,7 @@ module ts {
WriteArrayAsGenericType = 0x00000001, // Write Array<T> instead T[]
UseTypeOfFunction = 0x00000002, // Write typeof instead of function type literal
NoTruncation = 0x00000004, // Don't truncate typeToString result
NoArrowStyleTopLevelSignature = 0x00000008, // Do not write type global top level function or constructor literal
}
export enum SymbolAccessibility {

View file

@ -772,35 +772,35 @@ module FourSlash {
var actualQuickInfoSymbolName = actualQuickInfo ? actualQuickInfo.fullSymbolName : "";
var actualQuickInfoKind = actualQuickInfo ? actualQuickInfo.kind : "";
function assertionMessage(name: string, actualValue: string, expectedValue: string) {
return "\nActual " + name + ":\n\t" + actualValue + "\nExpected value:\n\t" + expectedValue;
function assertionMessage(msg: string) {
return "\nMarker: " + currentTestState.lastKnownMarker + "\nChecking: " + msg + "\n\n";
}
if (negative) {
if (expectedTypeName !== undefined) {
assert.notEqual(actualQuickInfoMemberName, expectedTypeName, assertionMessage("quick info member name", actualQuickInfoMemberName, expectedTypeName));
assert.notEqual(actualQuickInfoMemberName, expectedTypeName, assertionMessage("quick info member name"));
}
if (docComment != undefined) {
assert.notEqual(actualQuickInfoDocComment, docComment, assertionMessage("quick info doc comment", actualQuickInfoDocComment, docComment));
assert.notEqual(actualQuickInfoDocComment, docComment, assertionMessage("quick info doc comment"));
}
if (symbolName !== undefined) {
assert.notEqual(actualQuickInfoSymbolName, symbolName, assertionMessage("quick info symbol name", actualQuickInfoSymbolName, symbolName));
assert.notEqual(actualQuickInfoSymbolName, symbolName, assertionMessage("quick info symbol name"));
}
if (kind !== undefined) {
assert.notEqual(actualQuickInfoKind, kind, assertionMessage("quick info kind", actualQuickInfoKind, kind));
assert.notEqual(actualQuickInfoKind, kind, assertionMessage("quick info kind"));
}
} else {
if (expectedTypeName !== undefined) {
assert.equal(actualQuickInfoMemberName, expectedTypeName, assertionMessage("quick info member", actualQuickInfoMemberName, expectedTypeName));
assert.equal(actualQuickInfoMemberName, expectedTypeName, assertionMessage("quick info member"));
}
if (docComment != undefined) {
assert.equal(actualQuickInfoDocComment, docComment, assertionMessage("quick info doc", actualQuickInfoDocComment, docComment));
assert.equal(actualQuickInfoDocComment, docComment, assertionMessage("quick info doc"));
}
if (symbolName !== undefined) {
assert.equal(actualQuickInfoSymbolName, symbolName, assertionMessage("quick info symbol name", actualQuickInfoSymbolName, symbolName));
assert.equal(actualQuickInfoSymbolName, symbolName, assertionMessage("quick info symbol name"));
}
if (kind !== undefined) {
assert.equal(actualQuickInfoKind, kind, assertionMessage("quick info kind", actualQuickInfoKind, kind));
assert.equal(actualQuickInfoKind, kind, assertionMessage("quick info kind"));
}
}
}

View file

@ -2213,6 +2213,297 @@ module ts {
};
}
function getJsDocCommentOfSymbol(symbol: Symbol) {
var paramTag = "@param";
var jsDocCommentText: string[] = [];
ts.forEach(symbol.declarations, declaration => {
var sourceFileOfDeclaration = getSourceFileOfNode(declaration);
// If it is parameter - try and get the jsDoc comment with @param tag from function declaration's jsDoc comments
if (declaration.kind === SyntaxKind.Parameter) {
ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration), jsDocCommentTextRange => {
var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration);
if (cleanedParamJsDocComment) {
jsDocCommentText.push(cleanedParamJsDocComment);
}
});
}
// Get the cleaned js doc comment text from the declaration
ts.forEach(getJsDocCommentTextRange(
declaration.kind === SyntaxKind.VariableDeclaration ? declaration.parent : declaration, sourceFileOfDeclaration), jsDocCommentTextRange => {
var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration);
if (cleanedJsDocComment) {
jsDocCommentText.push(cleanedJsDocComment);
}
});
});
return jsDocCommentText.join("\n");
function getJsDocCommentTextRange(node: Node, sourceFile: SourceFile): TextRange[] {
return ts.map(getJsDocComments(node, sourceFile),
jsDocComment => {
return {
pos: jsDocComment.pos + "/*".length, // Consume /* from the comment
end: jsDocComment.end - "*/".length // Trim off comment end indicator
};
});
}
function consumeWhiteSpacesOnTheLine(pos: number, end: number, sourceFile: SourceFile, maxSpacesToRemove?: number) {
if (maxSpacesToRemove !== undefined) {
end = Math.min(end, pos + maxSpacesToRemove);
}
for (; pos < end; pos++) {
var ch = sourceFile.text.charCodeAt(pos);
if (!isWhiteSpace(ch) || isLineBreak(ch)) {
// Either found lineBreak or non whiteSpace
return pos;
}
}
return end;
}
function consumeLineBreaks(pos: number, end: number, sourceFile: SourceFile) {
while (pos < end && isLineBreak(sourceFile.text.charCodeAt(pos))) {
pos++;
}
return pos;
}
function isName(pos: number, end: number, sourceFile: SourceFile, name: string) {
return pos + name.length < end &&
sourceFile.text.substr(pos, name.length) === name &&
isWhiteSpace(sourceFile.text.charCodeAt(pos + name.length));
}
function isParamTag(pos: number, end: number, sourceFile: SourceFile) {
// If it is @param tag
return isName(pos, end, sourceFile, paramTag);
}
function getCleanedJsDocComment(pos: number, end: number, sourceFile: SourceFile) {
var spacesToRemoveAfterAsterisk: number;
var docComments: string[] = [];
var isInParamTag = false;
while (pos < end) {
var docCommentTextOfLine = "";
// First consume leading white space
pos = consumeWhiteSpacesOnTheLine(pos, end, sourceFile);
// If the comment starts with '*' consume the spaces on this line
if (pos < end && sourceFile.text.charCodeAt(pos) === CharacterCodes.asterisk) {
var lineStartPos = pos + 1;
pos = consumeWhiteSpacesOnTheLine(pos + 1, end, sourceFile, spacesToRemoveAfterAsterisk);
// Set the spaces to remove after asterisk as margin if not already set
if (spacesToRemoveAfterAsterisk === undefined && pos < end && !isLineBreak(sourceFile.text.charCodeAt(pos))) {
spacesToRemoveAfterAsterisk = pos - lineStartPos;
}
}
else if (spacesToRemoveAfterAsterisk === undefined) {
spacesToRemoveAfterAsterisk = 0;
}
// Analyse text on this line
while (pos < end && !isLineBreak(sourceFile.text.charCodeAt(pos))) {
var ch = sourceFile.text.charAt(pos);
if (ch === "@") {
// If it is @param tag
if (isParamTag(pos, end, sourceFile)) {
isInParamTag = true;
pos += paramTag.length;
continue;
}
else {
isInParamTag = false;
}
}
// Add the ch to doc text if we arent in param tag
if (!isInParamTag) {
docCommentTextOfLine += ch;
}
// Scan next character
pos++;
}
// Continue with next line
pos = consumeLineBreaks(pos, end, sourceFile);
if (docCommentTextOfLine) {
docComments.push(docCommentTextOfLine);
}
}
return docComments.join("\n");
}
function getCleanedParamJsDocComment(pos: number, end: number, sourceFile: SourceFile) {
var paramHelpStringMargin: number;
var paramDocComments: string[] = [];
while (pos < end) {
if (isParamTag(pos, end, sourceFile)) {
// Consume leading spaces
pos = consumeWhiteSpaces(pos + paramTag.length);
if (pos >= end) {
break;
}
// Ignore type expression
if (sourceFile.text.charCodeAt(pos) === CharacterCodes.openBrace) {
pos++;
for (var curlies = 1; pos < end; pos++) {
var charCode = sourceFile.text.charCodeAt(pos);
// { character means we need to find another } to match the found one
if (charCode === CharacterCodes.openBrace) {
curlies++;
continue;
}
// } char
if (charCode === CharacterCodes.closeBrace) {
curlies--;
if (curlies === 0) {
// We do not have any more } to match the type expression is ignored completely
pos++;
break;
}
else {
// there are more { to be matched with }
continue;
}
}
// Found start of another tag
if (charCode === CharacterCodes.at) {
break;
}
}
// Consume white spaces
pos = consumeWhiteSpaces(pos);
if (pos >= end) {
break;
}
}
// Parameter name
if (isName(pos, end, sourceFile, symbol.name)) {
// Found the parameter we are looking for consume white spaces
pos = consumeWhiteSpaces(pos + symbol.name.length);
if (pos >= end) {
break;
}
var paramHelpString = "";
var firstLineParamHelpStringPos = pos;
while (pos < end) {
var ch = sourceFile.text.charCodeAt(pos);
// at line break, set this comment line text and go to next line
if (isLineBreak(ch)) {
if (paramHelpString) {
paramDocComments.push(paramHelpString);
paramHelpString = "";
}
// Get the pos after cleaning start of the line
setPosForParamHelpStringOnNextLine(firstLineParamHelpStringPos);
continue;
}
// Done scanning param help string - next tag found
if (ch === CharacterCodes.at) {
break;
}
paramHelpString += sourceFile.text.charAt(pos);
// Go to next character
pos++;
}
// If there is param help text, add it top the doc comments
if (paramHelpString) {
paramDocComments.push(paramHelpString);
}
paramHelpStringMargin = undefined;
}
// If this is the start of another tag, continue with the loop in seach of param tag with symbol name
if (sourceFile.text.charCodeAt(pos) === CharacterCodes.at) {
continue;
}
}
// Next character
pos++;
}
return paramDocComments.join("\n");
function consumeWhiteSpaces(pos: number) {
while (pos < end && isWhiteSpace(sourceFile.text.charCodeAt(pos))) {
pos++;
}
return pos;
}
function setPosForParamHelpStringOnNextLine(firstLineParamHelpStringPos: number) {
// Get the pos after consuming line breaks
pos = consumeLineBreaks(pos, end, sourceFile);
if (pos >= end) {
return;
}
if (paramHelpStringMargin === undefined) {
paramHelpStringMargin = sourceFile.getLineAndCharacterFromPosition(firstLineParamHelpStringPos).character - 1;
}
// Now consume white spaces max
var startOfLinePos = pos;
pos = consumeWhiteSpacesOnTheLine(pos, end, sourceFile, paramHelpStringMargin);
if (pos >= end) {
return;
}
var consumedSpaces = pos - startOfLinePos;
if (consumedSpaces < paramHelpStringMargin) {
var ch = sourceFile.text.charCodeAt(pos);
if (ch === CharacterCodes.asterisk) {
// Consume more spaces after asterisk
pos = consumeWhiteSpacesOnTheLine(pos + 1, end, sourceFile, paramHelpStringMargin - consumedSpaces - 1);
}
}
}
}
}
function getTypeFormatFlags(symbolKind: ScriptElementKind) {
var typeFormatFlags = TypeFormatFlags.NoTruncation;
switch (symbolKind) {
case ScriptElementKind.functionElement:
case ScriptElementKind.memberGetAccessorElement:
case ScriptElementKind.memberSetAccessorElement:
case ScriptElementKind.memberFunctionElement:
case ScriptElementKind.constructSignatureElement:
case ScriptElementKind.callSignatureElement:
case ScriptElementKind.constructorImplementationElement:
case ScriptElementKind.constructSignatureElement:
typeFormatFlags = typeFormatFlags | TypeFormatFlags.NoArrowStyleTopLevelSignature;
}
return typeFormatFlags;
}
function getCompletionEntryDetails(filename: string, position: number, entryName: string) {
// Note: No need to call synchronizeHostData, as we have captured all the data we need
// in the getCompletionsAtPosition earlier
@ -2234,9 +2525,9 @@ module ts {
name: entryName,
kind: completionEntry.kind,
kindModifiers: completionEntry.kindModifiers,
type: session.typeChecker.typeToString(type, session.location),
type: session.typeChecker.typeToString(type, session.location, getTypeFormatFlags(completionEntry.kind)),
fullSymbolName: typeInfoResolver.symbolToString(symbol, session.location),
docComment: ""
docComment: getJsDocCommentOfSymbol(symbol)
};
}
else {
@ -2281,7 +2572,12 @@ module ts {
if (flags & SymbolFlags.Class) return ScriptElementKind.classElement;
if (flags & SymbolFlags.Interface) return ScriptElementKind.interfaceElement;
if (flags & SymbolFlags.Enum) return ScriptElementKind.enumElement;
if (flags & SymbolFlags.Variable) return ScriptElementKind.variableElement;
if (flags & SymbolFlags.Variable) {
if (ts.forEach(symbol.declarations, declaration => declaration.kind === SyntaxKind.Parameter)) {
return ScriptElementKind.parameterElement;
}
return ScriptElementKind.variableElement;
}
if (flags & SymbolFlags.Function) return ScriptElementKind.functionElement;
if (flags & SymbolFlags.GetAccessor) return ScriptElementKind.memberGetAccessorElement;
if (flags & SymbolFlags.SetAccessor) return ScriptElementKind.memberSetAccessorElement;
@ -2474,9 +2770,10 @@ module ts {
var symbol = typeInfoResolver.getSymbolInfo(node);
var type = symbol && typeInfoResolver.getTypeOfSymbol(symbol);
if (type) {
var symbolKind = getSymbolKind(symbol);
return {
memberName: new TypeScript.MemberNameString(typeInfoResolver.typeToString(type)),
docComment: "",
memberName: new TypeScript.MemberNameString(typeInfoResolver.typeToString(type, undefined, getTypeFormatFlags(symbolKind))),
docComment: getJsDocCommentOfSymbol(symbol),
fullSymbolName: typeInfoResolver.symbolToString(symbol, getContainerNode(node)),
kind: getSymbolKind(symbol),
textSpan: TypeScript.TextSpan.fromBounds(node.pos, node.end)

View file

@ -43,7 +43,7 @@
////jsDocMix/*6q*/edComments1(/*6*/);
////
/////// Triple slash comment
/////** jsdoc comment */ /*** another jsDocComment*/
/////** jsdoc comment */ /** another jsDocComment*/
////function jsDocMixedComments2() {
////}
////jsDocMi/*7q*/xedComments2(/*7*/);
@ -54,7 +54,7 @@
////}
////jsDocMixe/*8q*/dComments3(/*8*/);
////
/////** jsdoc comment */ /*** another jsDocComment*/
/////** jsdoc comment */ /** another jsDocComment*/
/////// Triple slash comment
/////// Triple slash comment 2
////function jsDocMixedComments4() {
@ -62,14 +62,14 @@
////jsDocMixed/*9q*/Comments4(/*9*/);
////
/////// Triple slash comment 1
/////** jsdoc comment */ /*** another jsDocComment*/
/////** jsdoc comment */ /** another jsDocComment*/
/////// Triple slash comment
/////// Triple slash comment 2
////function jsDocMixedComments5() {
////}
////jsDocM/*10q*/ixedComments5(/*10*/);
////
/////*** another jsDocComment*/
/////** another jsDocComment*/
/////// Triple slash comment 1
/////// Triple slash comment
/////// Triple slash comment 2
@ -95,7 +95,7 @@
//// * @param {number} a first number
//// * @param b second number
//// */
////function sum(a: number, b: number) {
////function sum(/*16aq*/a: number, /*17aq*/b: number) {
//// return /*18*/a + b;
////}
/////*15*/s/*16q*/um(/*16*/10, /*17*/20);
@ -106,14 +106,14 @@
/////** @param c {
//// @param d @anotherTag*/
/////** @param e LastParam @anotherTag*/
////function multiply(a: number, b: number, c?: number, d?, e?) {
////function multiply(/*19aq*/a: number, /*20aq*/b: number, /*21aq*/c?: number, /*22aq*/d?, /*23aq*/e?) {
////}
////mult/*19q*/iply(/*19*/10,/*20*/ 20,/*21*/ 30, /*22*/40, /*23*/50);
/////** fn f1 with number
////* @param { string} b about b
////*/
////function f1(a: number);
////function f1(b: string);
////function f1(/*25aq*/a: number);
////function f1(/*26aq*/b: string);
/////**@param opt optional parameter*/
////function f1(aOrb, opt?) {
//// return /*24*/aOrb;
@ -129,7 +129,7 @@
////@param { { () => string; } } e this is optional param e
////@param { { { () => string; } } f this is optional param f
////*/
////function subtract(a: number, b: number, c?: () => string, d?: () => string, e?: () => string, f?: () => string) {
////function subtract(/*28aq*/a: number, /*29aq*/b: number, /*30aq*/c?: () => string, /*31aq*/d?: () => string, /*32aq*/e?: () => string, /*33aq*/f?: () => string) {
////}
////subt/*28q*/ract(/*28*/10, /*29*/ 20, /*30*/ null, /*31*/ null, /*32*/ null, /*33*/null);
/////** this is square function
@ -137,7 +137,7 @@
////@param { number } a this is input number
////@returnType { number } it is return type
////*/
////function square(a: number) {
////function square(/*34aq*/a: number) {
//// return a * a;
////}
////squ/*34q*/are(/*34*/10);
@ -146,7 +146,7 @@
////@paramTag { number } g this is optional param g
////@param { number} b this is b
////*/
////function divide(a: number, b: number) {
////function divide(/*35aq*/a: number, /*36aq*/b: number) {
////}
////div/*35q*/ide(/*35*/10, /*36*/20);
/////**
@ -154,7 +154,7 @@
////@param {string} foo is string
////@param {string} bar is second string
////*/
////function fooBar(foo: string, bar: string) {
////function fooBar(/*37aq*/foo: string, /*38aq*/bar: string) {
//// return foo + bar;
////}
////fo/*37q*/oBar(/*37*/"foo",/*38*/"bar");
@ -168,7 +168,7 @@
////*@param a it is first parameter
////*@param c it is third parameter
////*/
////function jsDocParamTest(/** this is inline comment for a */a: number, /** this is inline comment for b*/ b: number, c: number, d: number) {
////function jsDocParamTest(/** this is inline comment for a *//*40aq*/a: number, /** this is inline comment for b*/ /*41aq*/b: number, /*42aq*/c: number, /*43aq*/d: number) {
//// return /*39*/a + b + c + d;
////}
/////*44*/jsD/*40q*/ocParamTest(/*40*/30, /*41*/40, /*42*/50, /*43*/60);
@ -195,7 +195,7 @@
//// * @param c this is info about b
//// * not aligned text about parameter will eat only one space
//// */
////function jsDocCommentAlignmentTest3(a: string, b, c) {
////function jsDocCommentAlignmentTest3(/*47aq*/a: string, /*48aq*/b, /*49aq*/c) {
////}
////jsDocComme/*47q*/ntAlignmentTest3(/*47*/"hello",/*48*/1, /*49*/2);
/////**/
@ -203,72 +203,72 @@
////}
goTo.marker('1');
verify.currentSignatureHelpDocCommentIs("");
//verify.currentSignatureHelpDocCommentIs("");
goTo.marker('1q');
verify.quickInfoIs("(): void", "", "simple", "function");
goTo.marker('2');
verify.currentSignatureHelpDocCommentIs("");
//verify.currentSignatureHelpDocCommentIs("");
goTo.marker('2q');
verify.quickInfoIs("(): void", "", "multiLine", "function");
goTo.marker('3');
verify.currentSignatureHelpDocCommentIs("this is eg of single line jsdoc style comment ");
//verify.currentSignatureHelpDocCommentIs("this is eg of single line jsdoc style comment ");
goTo.marker('3q');
verify.quickInfoIs("(): void", "this is eg of single line jsdoc style comment ", "jsDocSingleLine", "function");
goTo.marker('4');
verify.currentSignatureHelpDocCommentIs("this is multiple line jsdoc stule comment\nNew line1\nNew Line2");
//verify.currentSignatureHelpDocCommentIs("this is multiple line jsdoc stule comment\nNew line1\nNew Line2");
goTo.marker('4q');
verify.quickInfoIs("(): void", "this is multiple line jsdoc stule comment\nNew line1\nNew Line2", "jsDocMultiLine", "function");
goTo.marker('5');
verify.currentSignatureHelpDocCommentIs("this is multiple line jsdoc stule comment\nNew line1\nNew Line2\nShoul mege this line as well\nand this too\nAnother this one too");
//verify.currentSignatureHelpDocCommentIs("this is multiple line jsdoc stule comment\nNew line1\nNew Line2\nShoul mege this line as well\nand this too\nAnother this one too");
goTo.marker('5q');
verify.quickInfoIs("(): void", "this is multiple line jsdoc stule comment\nNew line1\nNew Line2\nShoul mege this line as well\nand this too\nAnother this one too", "jsDocMultiLineMerge", "function");
goTo.marker('6');
verify.currentSignatureHelpDocCommentIs("jsdoc comment ");
//verify.currentSignatureHelpDocCommentIs("jsdoc comment ");
goTo.marker('6q');
verify.quickInfoIs("(): void", "jsdoc comment ", "jsDocMixedComments1", "function");
goTo.marker('7');
verify.currentSignatureHelpDocCommentIs("jsdoc comment \nanother jsDocComment");
//verify.currentSignatureHelpDocCommentIs("jsdoc comment \nanother jsDocComment");
goTo.marker('7q');
verify.quickInfoIs("(): void", "jsdoc comment \nanother jsDocComment", "jsDocMixedComments2", "function");
goTo.marker('8');
verify.currentSignatureHelpDocCommentIs("jsdoc comment \nanother jsDocComment");
//verify.currentSignatureHelpDocCommentIs("jsdoc comment \n* another jsDocComment");
goTo.marker('8q');
verify.quickInfoIs("(): void", "jsdoc comment \nanother jsDocComment", "jsDocMixedComments3", "function");
verify.quickInfoIs("(): void", "jsdoc comment \n* another jsDocComment", "jsDocMixedComments3", "function");
goTo.marker('9');
verify.currentSignatureHelpDocCommentIs("jsdoc comment \nanother jsDocComment");
//verify.currentSignatureHelpDocCommentIs("jsdoc comment \nanother jsDocComment");
goTo.marker('9q');
verify.quickInfoIs("(): void", "jsdoc comment \nanother jsDocComment", "jsDocMixedComments4", "function");
goTo.marker('10');
verify.currentSignatureHelpDocCommentIs("jsdoc comment \nanother jsDocComment");
//verify.currentSignatureHelpDocCommentIs("jsdoc comment \nanother jsDocComment");
goTo.marker('10q');
verify.quickInfoIs("(): void", "jsdoc comment \nanother jsDocComment", "jsDocMixedComments5", "function");
goTo.marker('11');
verify.currentSignatureHelpDocCommentIs("another jsDocComment\njsdoc comment ");
//verify.currentSignatureHelpDocCommentIs("another jsDocComment\njsdoc comment ");
goTo.marker('11q');
verify.quickInfoIs("(): void", "another jsDocComment\njsdoc comment ", "jsDocMixedComments6", "function");
goTo.marker('12');
verify.currentSignatureHelpDocCommentIs("");
//verify.currentSignatureHelpDocCommentIs("");
goTo.marker('12q');
verify.quickInfoIs("(): void", "", "noHelpComment1", "function");
goTo.marker('13');
verify.currentSignatureHelpDocCommentIs("");
//verify.currentSignatureHelpDocCommentIs("");
goTo.marker('13q');
verify.quickInfoIs("(): void", "", "noHelpComment2", "function");
goTo.marker('14');
verify.currentSignatureHelpDocCommentIs("");
//verify.currentSignatureHelpDocCommentIs("");
goTo.marker('14q');
verify.quickInfoIs("(): void", "", "noHelpComment3", "function");
@ -276,14 +276,18 @@ goTo.marker('15');
verify.completionListContains("sum", "(a: number, b: number): number", "Adds two integers and returns the result", "sum", "function");
goTo.marker('16');
verify.currentSignatureHelpDocCommentIs("Adds two integers and returns the result");
verify.currentParameterHelpArgumentDocCommentIs("first number");
//verify.currentSignatureHelpDocCommentIs("Adds two integers and returns the result");
//verify.currentParameterHelpArgumentDocCommentIs("first number");
goTo.marker('16q');
verify.quickInfoIs("(a: number, b: number): number", "Adds two integers and returns the result", "sum", "function");
goTo.marker('16aq');
verify.quickInfoIs("number", "first number", "a", "parameter");
goTo.marker('17');
verify.currentSignatureHelpDocCommentIs("Adds two integers and returns the result");
verify.currentParameterHelpArgumentDocCommentIs("second number");
//verify.currentSignatureHelpDocCommentIs("Adds two integers and returns the result");
//verify.currentParameterHelpArgumentDocCommentIs("second number");
goTo.marker('17aq');
verify.quickInfoIs("number", "second number", "b", "parameter");
goTo.marker('18');
verify.quickInfoIs("number", "first number", "a", "parameter");
@ -291,98 +295,139 @@ verify.completionListContains("a", "number", "first number", "a", "parameter");
verify.completionListContains("b", "number", "second number", "b", "parameter");
goTo.marker('19');
verify.currentSignatureHelpDocCommentIs("This is multiplication function\n@anotherTag\n@anotherTag");
verify.currentParameterHelpArgumentDocCommentIs("first number");
//verify.currentSignatureHelpDocCommentIs("This is multiplication function\n@anotherTag\n@anotherTag");
//verify.currentParameterHelpArgumentDocCommentIs("first number");
goTo.marker('19q');
verify.quickInfoIs("(a: number, b: number, c?: number, d?: any, e?: any): void", "This is multiplication function\n@anotherTag\n@anotherTag", "multiply", "function");
goTo.marker('19aq');
verify.quickInfoIs("number", "first number", "a", "parameter");
goTo.marker('20');
verify.currentSignatureHelpDocCommentIs("This is multiplication function\n@anotherTag\n@anotherTag");
verify.currentParameterHelpArgumentDocCommentIs("");
//verify.currentSignatureHelpDocCommentIs("This is multiplication function\n@anotherTag\n@anotherTag");
//verify.currentParameterHelpArgumentDocCommentIs("");
goTo.marker('20aq');
verify.quickInfoIs("number", "", "b", "parameter");
goTo.marker('21');
verify.currentSignatureHelpDocCommentIs("This is multiplication function\n@anotherTag\n@anotherTag");
verify.currentParameterHelpArgumentDocCommentIs("{");
//verify.currentSignatureHelpDocCommentIs("This is multiplication function\n@anotherTag\n@anotherTag");
//verify.currentParameterHelpArgumentDocCommentIs("{");
goTo.marker('21aq');
verify.quickInfoIs("number", "{", "c", "parameter");
goTo.marker('22');
verify.currentSignatureHelpDocCommentIs("This is multiplication function\n@anotherTag\n@anotherTag");
verify.currentParameterHelpArgumentDocCommentIs("");
//verify.currentSignatureHelpDocCommentIs("This is multiplication function\n@anotherTag\n@anotherTag");
//verify.currentParameterHelpArgumentDocCommentIs("");
goTo.marker('22aq');
verify.quickInfoIs("any", "", "d", "parameter");
goTo.marker('23');
verify.currentSignatureHelpDocCommentIs("This is multiplication function\n@anotherTag\n@anotherTag");
verify.currentParameterHelpArgumentDocCommentIs("LastParam ");
//verify.currentSignatureHelpDocCommentIs("This is multiplication function\n@anotherTag\n@anotherTag");
//verify.currentParameterHelpArgumentDocCommentIs("LastParam ");
goTo.marker('23aq');
verify.quickInfoIs("any", "LastParam ", "e", "parameter");
goTo.marker('24');
verify.completionListContains("aOrb", "any", "", "aOrb", "parameter");
verify.completionListContains("opt", "any", "optional parameter", "opt", "parameter");
goTo.marker('25');
verify.currentSignatureHelpDocCommentIs("fn f1 with number");
verify.currentParameterHelpArgumentDocCommentIs("");
//verify.currentSignatureHelpDocCommentIs("fn f1 with number");
//verify.currentParameterHelpArgumentDocCommentIs("");
goTo.marker('25q');
verify.quickInfoIs("(a: number): any (+ 1 overload(s))", "fn f1 with number", "f1", "function");
// TODO: type name format for the overload
//verify.quickInfoIs("(a: number): any (+ 1 overload(s))", "fn f1 with number", "f1", "function");
verify.quickInfoIs(undefined, "fn f1 with number", "f1", "function");
goTo.marker('25aq');
verify.quickInfoIs("number", "", "a", "parameter");
goTo.marker('26');
verify.currentSignatureHelpDocCommentIs("");
verify.currentParameterHelpArgumentDocCommentIs("");
//verify.currentSignatureHelpDocCommentIs("");
//verify.currentParameterHelpArgumentDocCommentIs("");
goTo.marker('26q');
verify.quickInfoIs("(b: string): any (+ 1 overload(s))", "", "f1", "function");
// TODO: Selection of correct overload and doc comment only from that overload
//verify.quickInfoIs("(b: string): any (+ 1 overload(s))", "", "f1", "function");
goTo.marker('26aq');
verify.quickInfoIs("string", "", "b", "parameter");
goTo.marker('27');
verify.completionListContains("multiply", "(a: number, b: number, c?: number, d?: any, e?: any): void", "This is multiplication function\n@anotherTag\n@anotherTag", "multiply", "function");
verify.completionListContains("f1", "(a: number): any (+ 1 overload(s))", "fn f1 with number", "f1", "function");
// TODO: overload formatting
//verify.completionListContains("f1", "(a: number): any (+ 1 overload(s))", "fn f1 with number", "f1", "function");
verify.completionListContains("f1", undefined, "fn f1 with number", "f1", "function");
goTo.marker('28');
verify.currentSignatureHelpDocCommentIs("This is subtract function");
verify.currentParameterHelpArgumentDocCommentIs("");
//verify.currentSignatureHelpDocCommentIs("This is subtract function");
//verify.currentParameterHelpArgumentDocCommentIs("");
goTo.marker('28q');
verify.quickInfoIs("(a: number, b: number, c?: () => string, d?: () => string, e?: () => string, f?: () => string): void", "This is subtract function", "subtract", "function");
goTo.marker('28aq');
verify.quickInfoIs("number", "", "a", "parameter");
goTo.marker('29');
verify.currentSignatureHelpDocCommentIs("This is subtract function");
verify.currentParameterHelpArgumentDocCommentIs("this is about b");
//verify.currentSignatureHelpDocCommentIs("This is subtract function");
//verify.currentParameterHelpArgumentDocCommentIs("this is about b");
goTo.marker('29aq');
verify.quickInfoIs("number", "this is about b", "b", "parameter");
goTo.marker('30');
verify.currentSignatureHelpDocCommentIs("This is subtract function");
verify.currentParameterHelpArgumentDocCommentIs("this is optional param c");
//verify.currentSignatureHelpDocCommentIs("This is subtract function");
//verify.currentParameterHelpArgumentDocCommentIs("this is optional param c");
goTo.marker('30aq');
verify.quickInfoIs("() => string", "this is optional param c", "c", "parameter");
goTo.marker('31');
verify.currentSignatureHelpDocCommentIs("This is subtract function");
verify.currentParameterHelpArgumentDocCommentIs("");
//verify.currentSignatureHelpDocCommentIs("This is subtract function");
//verify.currentParameterHelpArgumentDocCommentIs("");
goTo.marker('31aq');
verify.quickInfoIs("() => string", "", "d", "parameter");
goTo.marker('32');
verify.currentSignatureHelpDocCommentIs("This is subtract function");
verify.currentParameterHelpArgumentDocCommentIs("this is optional param e");
//verify.currentSignatureHelpDocCommentIs("This is subtract function");
//verify.currentParameterHelpArgumentDocCommentIs("this is optional param e");
goTo.marker('32aq');
verify.quickInfoIs("() => string", "this is optional param e", "e", "parameter");
goTo.marker('33');
verify.currentSignatureHelpDocCommentIs("This is subtract function");
verify.currentParameterHelpArgumentDocCommentIs("");
//verify.currentSignatureHelpDocCommentIs("This is subtract function");
//verify.currentParameterHelpArgumentDocCommentIs("");
goTo.marker('33aq');
verify.quickInfoIs("() => string", "", "f", "parameter");
goTo.marker('34');
verify.currentSignatureHelpDocCommentIs("this is square function\n@paramTag { number } a this is input number of paramTag\n@returnType { number } it is return type");
verify.currentParameterHelpArgumentDocCommentIs("this is input number");
//verify.currentSignatureHelpDocCommentIs("this is square function\n@paramTag { number } a this is input number of paramTag\n@returnType { number } it is return type");
//verify.currentParameterHelpArgumentDocCommentIs("this is input number");
goTo.marker('34q');
verify.quickInfoIs("(a: number): number", "this is square function\n@paramTag { number } a this is input number of paramTag\n@returnType { number } it is return type", "square", "function");
goTo.marker('34aq');
verify.quickInfoIs("number", "this is input number", "a", "parameter");
goTo.marker('35');
verify.currentSignatureHelpDocCommentIs("this is divide function\n@paramTag { number } g this is optional param g");
verify.currentParameterHelpArgumentDocCommentIs("this is a");
//verify.currentSignatureHelpDocCommentIs("this is divide function\n@paramTag { number } g this is optional param g");
//verify.currentParameterHelpArgumentDocCommentIs("this is a");
goTo.marker('35q');
verify.quickInfoIs("(a: number, b: number): void", "this is divide function\n@paramTag { number } g this is optional param g", "divide", "function");
goTo.marker('35aq');
verify.quickInfoIs("number", "this is a", "a", "parameter");
goTo.marker('36');
verify.currentSignatureHelpDocCommentIs("this is divide function\n@paramTag { number } g this is optional param g");
verify.currentParameterHelpArgumentDocCommentIs("this is b");
//verify.currentSignatureHelpDocCommentIs("this is divide function\n@paramTag { number } g this is optional param g");
//verify.currentParameterHelpArgumentDocCommentIs("this is b");
goTo.marker('36aq');
verify.quickInfoIs("number", "this is b", "b", "parameter");
goTo.marker('37');
verify.currentSignatureHelpDocCommentIs("Function returns string concat of foo and bar");
verify.currentParameterHelpArgumentDocCommentIs("is string");
//verify.currentSignatureHelpDocCommentIs("Function returns string concat of foo and bar");
//verify.currentParameterHelpArgumentDocCommentIs("is string");
goTo.marker('37q');
verify.quickInfoIs("(foo: string, bar: string): string", "Function returns string concat of foo and bar", "fooBar", "function");
goTo.marker('37aq');
verify.quickInfoIs("string", "is string", "foo", "parameter");
goTo.marker('38');
verify.currentSignatureHelpDocCommentIs("Function returns string concat of foo and bar");
verify.currentParameterHelpArgumentDocCommentIs("is second string");
//verify.currentSignatureHelpDocCommentIs("Function returns string concat of foo and bar");
//verify.currentParameterHelpArgumentDocCommentIs("is second string");
goTo.marker('38aq');
verify.quickInfoIs("string", "is second string", "bar", "parameter");
goTo.marker('39');
verify.completionListContains("a", "number", "it is first parameter\nthis is inline comment for a ", "a", "parameter");
@ -391,22 +436,30 @@ verify.completionListContains("c", "number", "it is third parameter", "c", "para
verify.completionListContains("d", "number", "", "d", "parameter");
goTo.marker('40');
verify.currentSignatureHelpDocCommentIs("this is jsdoc style function with param tag as well as inline parameter help");
verify.currentParameterHelpArgumentDocCommentIs("it is first parameter\nthis is inline comment for a ");
//verify.currentSignatureHelpDocCommentIs("this is jsdoc style function with param tag as well as inline parameter help");
//verify.currentParameterHelpArgumentDocCommentIs("it is first parameter\nthis is inline comment for a ");
goTo.marker('40q');
verify.quickInfoIs("(a: number, b: number, c: number, d: number): number", "this is jsdoc style function with param tag as well as inline parameter help", "jsDocParamTest", "function");
goTo.marker('40aq');
verify.quickInfoIs("number", "it is first parameter\nthis is inline comment for a ", "a", "parameter");
goTo.marker('41');
verify.currentSignatureHelpDocCommentIs("this is jsdoc style function with param tag as well as inline parameter help");
verify.currentParameterHelpArgumentDocCommentIs("this is inline comment for b");
//verify.currentSignatureHelpDocCommentIs("this is jsdoc style function with param tag as well as inline parameter help");
//verify.currentParameterHelpArgumentDocCommentIs("this is inline comment for b");
goTo.marker('41aq');
verify.quickInfoIs("number", "this is inline comment for b", "b", "parameter");
goTo.marker('42');
verify.currentSignatureHelpDocCommentIs("this is jsdoc style function with param tag as well as inline parameter help");
verify.currentParameterHelpArgumentDocCommentIs("it is third parameter");
//verify.currentSignatureHelpDocCommentIs("this is jsdoc style function with param tag as well as inline parameter help");
//verify.currentParameterHelpArgumentDocCommentIs("it is third parameter");
goTo.marker('42aq');
verify.quickInfoIs("number", "it is third parameter", "c", "parameter");
goTo.marker('43');
verify.currentSignatureHelpDocCommentIs("this is jsdoc style function with param tag as well as inline parameter help");
verify.currentParameterHelpArgumentDocCommentIs("");
//verify.currentSignatureHelpDocCommentIs("this is jsdoc style function with param tag as well as inline parameter help");
//verify.currentParameterHelpArgumentDocCommentIs("");
goTo.marker('43aq');
verify.quickInfoIs("number", "", "d", "parameter");
goTo.marker('44');
verify.completionListContains("jsDocParamTest", "(a: number, b: number, c: number, d: number): number", "this is jsdoc style function with param tag as well as inline parameter help", "jsDocParamTest", "function");
@ -414,28 +467,34 @@ verify.completionListContains("x", "any", "This is a comment ", "x", "var");
verify.completionListContains("y", "any", "This is a comment ", "y", "var");
goTo.marker('45');
verify.currentSignatureHelpDocCommentIs("This is function comment\nAnd properly aligned comment ");
//verify.currentSignatureHelpDocCommentIs("This is function comment\nAnd properly aligned comment ");
goTo.marker('45q');
verify.quickInfoIs("(): void", "This is function comment\nAnd properly aligned comment ", "jsDocCommentAlignmentTest1", "function");
goTo.marker('46');
verify.currentSignatureHelpDocCommentIs("This is function comment\n And aligned with 4 space char margin");
//verify.currentSignatureHelpDocCommentIs("This is function comment\n And aligned with 4 space char margin");
goTo.marker('46q');
verify.quickInfoIs("(): void", "This is function comment\n And aligned with 4 space char margin", "jsDocCommentAlignmentTest2", "function");
goTo.marker('47');
verify.currentSignatureHelpDocCommentIs("This is function comment\n And aligned with 4 space char margin");
verify.currentParameterHelpArgumentDocCommentIs("this is info about a\nspanning on two lines and aligned perfectly");
//verify.currentSignatureHelpDocCommentIs("This is function comment\n And aligned with 4 space char margin");
//verify.currentParameterHelpArgumentDocCommentIs("this is info about a\nspanning on two lines and aligned perfectly");
goTo.marker('47q');
verify.quickInfoIs("(a: string, b: any, c: any): void", "This is function comment\n And aligned with 4 space char margin", "jsDocCommentAlignmentTest3", "function");
goTo.marker('47aq');
verify.quickInfoIs("string", "this is info about a\nspanning on two lines and aligned perfectly", "a", "parameter");
goTo.marker('48');
verify.currentSignatureHelpDocCommentIs("This is function comment\n And aligned with 4 space char margin");
verify.currentParameterHelpArgumentDocCommentIs("this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin");
//verify.currentSignatureHelpDocCommentIs("This is function comment\n And aligned with 4 space char margin");
//verify.currentParameterHelpArgumentDocCommentIs("this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin");
goTo.marker('48aq');
verify.quickInfoIs("any", "this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin", "b", "parameter");
goTo.marker('49');
verify.currentSignatureHelpDocCommentIs("This is function comment\n And aligned with 4 space char margin");
verify.currentParameterHelpArgumentDocCommentIs("this is info about b\nnot aligned text about parameter will eat only one space");
//verify.currentSignatureHelpDocCommentIs("This is function comment\n And aligned with 4 space char margin");
//verify.currentParameterHelpArgumentDocCommentIs("this is info about b\nnot aligned text about parameter will eat only one space");
goTo.marker('49aq');
verify.quickInfoIs("any", "this is info about b\nnot aligned text about parameter will eat only one space", "c", "parameter");
goTo.marker('50');
verify.quickInfoIs(undefined, "", "NoQuickInfoClass", "class");