Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b14d7c7

Browse filesBrowse files
committed
Add more jsdoc tests
1 parent 65d1079 commit b14d7c7
Copy full SHA for b14d7c7

11 files changed

+155-1Lines changed: 155 additions & 1 deletion
Expand file treeCollapse file tree
Open diff view settings
Collapse file
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// @allowJs: true
2+
// @filename: returns.js
3+
// @out: dummy.js
4+
/**
5+
* @returns {string} This comment is not currently exposed
6+
*/
7+
function f() {
8+
return "";
9+
}
Collapse file
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
///<reference path="fourslash.ts" />
2+
// @allowJs: true
3+
// @Filename: Foo.js
4+
/////**
5+
//// * Do some foo things
6+
//// * @template T A Foolish template
7+
//// * @param {T} x a parameter
8+
//// */
9+
////function foo(x) {
10+
////}
11+
////
12+
////fo/**/o()
13+
14+
goTo.marker();
15+
verify.quickInfoIs("function foo<T>(x: T): void", "Do some foo things");
Collapse file
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
///<reference path="fourslash.ts" />
2+
// @allowJs: true
3+
// @Filename: Foo.js
4+
/////**
5+
//// * @type {{ [name: string]: string; }} variables
6+
//// */
7+
////const vari/**/ables = {};
8+
goTo.marker();
9+
verify.quickInfoIs("const variables: {\n [name: string]: string;\n}");
Collapse file
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
///<reference path="fourslash.ts" />
3+
// @allowJs: true
4+
// @Filename: Foo.js
5+
/////**
6+
//// * @param {{ stringProp: string,
7+
//// * numProp: number }} o
8+
//// */
9+
////function f1(o) {
10+
//// o/**/;
11+
////}
12+
goTo.marker();
13+
verify.quickInfoIs("(parameter) o: any");
Collapse file

‎tests/cases/fourslash/jsDocFunctionSignatures2.ts‎

Copy file name to clipboardExpand all lines: tests/cases/fourslash/jsDocFunctionSignatures2.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
//// f6('', /**/false)
1010

1111
goTo.marker();
12-
verify.currentSignatureHelpIs('f6(p0: string, p1?: boolean): number')
12+
verify.currentSignatureHelpIs('f6(arg0: string, arg1?: boolean): number')
Collapse file
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
///<reference path="fourslash.ts" />
2+
// @allowJs: true
3+
// @Filename: Foo.js
4+
5+
/////**
6+
//// * Filters a path based on a regexp or glob pattern.
7+
//// * @param {String} basePath The base path where the search will be performed.
8+
//// * @param {String} pattern A string defining a regexp of a glob pattern.
9+
//// * @param {String} type The search pattern type, can be a regexp or a glob.
10+
//// * @param {Object} options A object containing options to the search.
11+
//// * @return {Array} A list containing the filtered paths.
12+
//// */
13+
////function pathFilter(basePath, pattern, type, options){
14+
//////...
15+
////}
16+
////pathFilter(/**/'foo', 'bar', 'baz', {});
17+
goTo.marker();
18+
verify.currentSignatureHelpDocCommentIs("Filters a path based on a regexp or glob pattern.");
Collapse file
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
///<reference path="fourslash.ts" />
2+
// @allowJs: true
3+
// @Filename: Foo.js
4+
/////**
5+
//// * @param {string} p1 - A string param
6+
//// * @param {string?} p2 - An optional param
7+
//// * @param {string} [p3] - Another optional param
8+
//// * @param {string} [p4="test"] - An optional param with a default value
9+
//// */
10+
////function f1(p1, p2, p3, p4){}
11+
////f1(/*1*/'foo', /*2*/'bar', /*3*/'baz', /*4*/'qux');
12+
goTo.marker('1');
13+
verify.currentParameterHelpArgumentDocCommentIs("- A string param");
14+
goTo.marker('2');
15+
verify.currentParameterHelpArgumentDocCommentIs("- An optional param ");
16+
goTo.marker('3');
17+
verify.currentParameterHelpArgumentDocCommentIs("- Another optional param");
18+
goTo.marker('4');
19+
verify.currentParameterHelpArgumentDocCommentIs("- An optional param with a default value");
Collapse file
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
///<reference path="fourslash.ts" />
2+
// @allowJs: true
3+
// @Filename: Foo.js
4+
/////**
5+
//// * @param {string} p0
6+
//// * @param {string} [p1]
7+
//// */
8+
////function Test(p0, p1) {
9+
//// this.P0 = p0;
10+
//// this.P1 = p1;
11+
////}
12+
////
13+
////
14+
////var /**/test = new Test("");
15+
goTo.marker();
16+
verify.quickInfoIs('var test: {\n P0: string;\n P1: string;\n}');
Collapse file
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
///<reference path="fourslash.ts" />
2+
// @allowJs: true
3+
// @Filename: Foo.js
4+
/////**
5+
//// * Represents a person
6+
//// * @constructor
7+
//// * @param {string} name The name of the person
8+
//// * @param {number} age The age of the person
9+
//// */
10+
////function Person(name, age) {
11+
//// this.name = name;
12+
//// this.age = age;
13+
////}
14+
////var p = new Pers/**/on();
15+
goTo.marker();
16+
verify.quickInfoIs("function Person(name: string, age: number): void", "Represents a person");
Collapse file
+22Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
///<reference path="fourslash.ts" />
2+
// @allowJs: true
3+
// @Filename: Foo.js
4+
/////** first line of the comment
5+
////
6+
////third line */
7+
////function foo() {}
8+
////foo/**/();
9+
goTo.marker();
10+
verify.verifyQuickInfoDisplayParts('function',
11+
'',
12+
{ start: 63, length: 3 },
13+
[{"text": "function", "kind": "keyword"},
14+
{"text": " ", "kind": "space"},
15+
{"text": "foo", "kind": "functionName"},
16+
{"text": "(", "kind": "punctuation"},
17+
{"text": ")", "kind": "punctuation"},
18+
{"text": ":", "kind": "punctuation"},
19+
{"text": " ", "kind": "space"},
20+
{"text": "void", "kind": "keyword"}
21+
],
22+
[{"text": "first line of the comment\n\nthird line ", "kind": "text"}]);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.