-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Merge JSDoc of assignments from function expressions #9010
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
sandersn
merged 4 commits into
master
from
merge-jsdoc-of-assignment-and-function-expression
Jun 8, 2016
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
/////** This comment should appear for foo*/ | ||
////function f/*1*/oo() { | ||
////} | ||
////f/*2*/oo/*3*/(/*4*/); | ||
/////** This is comment for function signature*/ | ||
////function fo/*5*/oWithParameters(/** this is comment about a*/a: string, | ||
//// /** this is comment for b*/ | ||
//// b: number) { | ||
//// var /*6*/d = /*7*/a; | ||
////} | ||
////fooWithParam/*8*/eters/*9*/(/*10*/"a",/*11*/10); | ||
|
||
// ambient declaration | ||
/////** | ||
////* Does something | ||
////* @param a a string | ||
////*/ | ||
////declare function fn(a: string); | ||
////fn(/*12*/"hello"); | ||
|
||
goTo.marker('1'); | ||
verify.quickInfoIs("function foo(): void", "This comment should appear for foo"); | ||
|
||
goTo.marker('2'); | ||
verify.quickInfoIs("function foo(): void", "This comment should appear for foo"); | ||
|
||
goTo.marker('3'); | ||
verify.completionListContains('foo', 'function foo(): void', 'This comment should appear for foo'); | ||
|
||
goTo.marker('4'); | ||
verify.currentSignatureHelpDocCommentIs("This comment should appear for foo"); | ||
|
||
goTo.marker('5'); | ||
verify.quickInfoIs("function fooWithParameters(a: string, b: number): void", "This is comment for function signature"); | ||
|
||
goTo.marker('6'); | ||
verify.quickInfoIs('(local var) d: string', ''); | ||
|
||
goTo.marker('7'); | ||
verify.completionListContains('a', '(parameter) a: string', 'this is comment about a'); | ||
verify.completionListContains('b', '(parameter) b: number', 'this is comment for b'); | ||
|
||
goTo.marker('8'); | ||
verify.quickInfoIs("function fooWithParameters(a: string, b: number): void", "This is comment for function signature"); | ||
|
||
goTo.marker('9'); | ||
verify.completionListContains('fooWithParameters', 'function fooWithParameters(a: string, b: number): void', 'This is comment for function signature'); | ||
|
||
goTo.marker('10'); | ||
verify.currentSignatureHelpDocCommentIs("This is comment for function signature"); | ||
verify.currentParameterHelpArgumentDocCommentIs("this is comment about a"); | ||
|
||
goTo.marker('11'); | ||
verify.currentSignatureHelpDocCommentIs("This is comment for function signature"); | ||
verify.currentParameterHelpArgumentDocCommentIs("this is comment for b"); | ||
|
||
goTo.marker('12'); | ||
verify.currentSignatureHelpDocCommentIs("Does something"); | ||
verify.currentParameterHelpArgumentDocCommentIs("a string"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
// test arrow doc comments | ||
/////** lamdaFoo var comment*/ | ||
////var lamb/*1*/daFoo = /** this is lambda comment*/ (/**param a*/a: number, /**param b*/b: number) => /*2*/a + b; | ||
////var lambddaN/*3*/oVarComment = /** this is lambda multiplication*/ (/**param a*/a: number, /**param b*/b: number) => a * b; | ||
/////*4*/lambdaFoo(/*5*/10, /*6*/20); | ||
|
||
// test nested arrow doc comments | ||
////function /*7*/anotherFunc(a: number) { | ||
//// /** documentation | ||
//// @param b {string} inner parameter */ | ||
//// var /*8*/lambdaVar = /** inner docs */(/*9*/b: string) => { | ||
//// var /*10*/localVar = "Hello "; | ||
//// return /*11*/localVar + /*12*/b; | ||
//// } | ||
//// return lamb/*13*/daVar("World") + a; | ||
////} | ||
|
||
// test function expression doc comments | ||
/////** | ||
//// * On variable | ||
//// * @param s the first parameter! | ||
//// * @returns the parameter's length | ||
//// */ | ||
////var assi/*14*/gned = /** | ||
//// * Summary on expression | ||
//// * @param s param on expression | ||
//// * @returns return on expression | ||
//// */function(/** On parameter */s: string) { | ||
//// return /*15*/s.length; | ||
////} | ||
////assig/*16*/ned/*17*/(/*18*/"hey"); | ||
|
||
|
||
|
||
goTo.marker('1'); | ||
verify.quickInfoIs("var lambdaFoo: (a: number, b: number) => number", "lamdaFoo var comment\nthis is lambda comment"); | ||
|
||
goTo.marker('2'); | ||
verify.completionListContains('a', '(parameter) a: number', 'param a'); | ||
verify.completionListContains('b', '(parameter) b: number', 'param b'); | ||
|
||
goTo.marker('3'); | ||
// pick up doccomments from the lambda itself | ||
verify.quickInfoIs("var lambddaNoVarComment: (a: number, b: number) => number", "this is lambda multiplication"); | ||
|
||
goTo.marker('4'); | ||
verify.completionListContains('lambdaFoo', 'var lambdaFoo: (a: number, b: number) => number', 'lamdaFoo var comment\nthis is lambda comment'); | ||
verify.completionListContains('lambddaNoVarComment', 'var lambddaNoVarComment: (a: number, b: number) => number', 'this is lambda multiplication'); | ||
|
||
goTo.marker('5'); | ||
verify.currentParameterHelpArgumentDocCommentIs("param a"); | ||
|
||
goTo.marker('6'); | ||
verify.currentParameterHelpArgumentDocCommentIs("param b"); | ||
|
||
|
||
|
||
|
||
goTo.marker('7'); | ||
// no documentation from nested lambda | ||
verify.quickInfoIs('function anotherFunc(a: number): string', ''); | ||
goTo.marker('8'); | ||
verify.quickInfoIs('(local var) lambdaVar: (b: string) => string', 'documentation\ninner docs '); | ||
goTo.marker('9'); | ||
verify.quickInfoIs('(parameter) b: string', '{string} inner parameter '); | ||
goTo.marker('10'); | ||
verify.quickInfoIs('(local var) localVar: string', ''); | ||
goTo.marker('11'); | ||
verify.quickInfoIs('(local var) localVar: string', ''); | ||
goTo.marker('12'); | ||
verify.quickInfoIs('(parameter) b: string', '{string} inner parameter '); | ||
goTo.marker('13'); | ||
verify.quickInfoIs('(local var) lambdaVar: (b: string) => string', 'documentation\ninner docs '); | ||
|
||
goTo.marker('14'); | ||
verify.quickInfoIs("var assigned: (s: string) => number", "On variable\n@returns the parameter's length\nSummary on expression\n@returns return on expression"); | ||
goTo.marker('15'); | ||
verify.completionListContains('s', '(parameter) s: string', "the first parameter!\nparam on expression\nOn parameter "); | ||
goTo.marker('16'); | ||
verify.quickInfoIs("var assigned: (s: string) => number", "On variable\n@returns the parameter's length\nSummary on expression\n@returns return on expression"); | ||
goTo.marker('17'); | ||
verify.completionListContains("assigned", "var assigned: (s: string) => number", "On variable\n@returns the parameter's length\nSummary on expression\n@returns return on expression"); | ||
goTo.marker('18'); | ||
verify.currentSignatureHelpDocCommentIs("On variable\n@returns the parameter's length\nSummary on expression\n@returns return on expression"); | ||
verify.currentParameterHelpArgumentDocCommentIs("the first parameter!\nparam on expression\nOn parameter "); | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There must be a function like
isFunctionExpressionLike
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is
isFunctionLike
, but that includes tons of other things like methods. The problem is that we seem to need (almost) all combinations of the function-like kinds, so we'd end up with one function for each, each with its own very-long name.