Skip to content

Commit

Permalink
Treat link tag as comment (#25206)
Browse files Browse the repository at this point in the history
* First attempt at parsing. Doesn't work

But my machine is dying, so this is an emergency commit.

* Parsing sort of works

But it's not right yet; the test I added fails. See the TODO I added.

* Parse link tag as comment
  • Loading branch information
sandersn authored Jun 25, 2018
1 parent 6a9e077 commit 99ebcd7
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/compiler/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6567,6 +6567,16 @@ namespace ts {
indent += whitespace.length;
}
break;
case SyntaxKind.OpenBraceToken:
state = JSDocState.SavingComments;
if (lookAhead(() => nextJSDocToken() === SyntaxKind.AtToken && tokenIsIdentifierOrKeyword(nextJSDocToken()) && scanner.getTokenText() === "link")) {
pushComment(scanner.getTokenText());
nextJSDocToken();
pushComment(scanner.getTokenText());
nextJSDocToken();
}
pushComment(scanner.getTokenText());
break;
case SyntaxKind.AsteriskToken:
if (state === JSDocState.BeginningOfLine) {
// leading asterisks start recording on the *next* (non-whitespace) token
Expand Down
6 changes: 6 additions & 0 deletions src/testRunner/unittests/jsDocParsing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,12 @@ namespace ts {
* @param {object} o Doc doc
* @param {string} o.f Doc for f
*/`);
parsesCorrectly("",

This comment has been minimized.

Copy link
@weswigham

weswigham Jun 25, 2018

Member

@sandersn you should name this test.

`/**
* {@link first link}
* Inside {@link link text} thing
* @see {@link second link text} and {@link Foo|a foo} as well.
*/`);
});
});
describe("getFirstToken", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{

This comment has been minimized.

Copy link
@weswigham

weswigham Jun 25, 2018

Member

@sandersn What's up with the name of this file?

"kind": "JSDocComment",
"pos": 0,
"end": 127,
"tags": {
"0": {
"kind": "JSDocTag",
"pos": 63,
"end": 68,
"atToken": {
"kind": "AtToken",
"pos": 63,
"end": 64
},
"tagName": {
"kind": "Identifier",
"pos": 64,
"end": 67,
"escapedText": "see"
},
"comment": "{@link second link text} and {@link Foo|a foo} as well."
},
"length": 1,
"pos": 63,
"end": 68
},
"comment": "{@link first link}\nInside {@link link text} thing"
}
Submodule TypeScript-Node-Starter updated 49 files
+11 −2 .env.example
+7 −1 .gitignore
+1 −0 .vscode/extensions.json
+3 −15 .vscode/launch.json
+8 −2 .vscode/settings.json
+190 −75 README.md
+0 −5 copyStaticAssets.js
+5 −0 copyStaticAssets.ts
+18 −0 jest.config.js
+1,722 −1,346 package-lock.json
+51 −59 package.json
+22 −19 src/app.ts
+5 −5 src/config/passport.ts
+3 −3 src/controllers/api.ts
+1 −1 src/controllers/contact.ts
+6 −6 src/controllers/user.ts
+9 −6 src/models/User.ts
+1 −1 src/public/css/lib/bootstrap/_button-groups.scss
+1 −1 src/public/css/lib/bootstrap/_forms.scss
+1 −1 src/public/css/lib/bootstrap/_input-groups.scss
+1 −1 src/public/css/lib/bootstrap/_panels.scss
+1 −1 src/public/css/lib/bootstrap/_scaffolding.scss
+2 −2 src/public/css/lib/bootstrap/_theme.scss
+1 −1 src/public/css/lib/bootstrap/_variables.scss
+2 −2 src/public/css/lib/bootstrap/bootstrap.scss
+3 −3 src/public/css/lib/bootstrap/mixins/_tab-focus.scss
+ src/public/fonts/glyphicons-halflings-regular.eot
+288 −0 src/public/fonts/glyphicons-halflings-regular.svg
+ src/public/fonts/glyphicons-halflings-regular.ttf
+ src/public/fonts/glyphicons-halflings-regular.woff
+ src/public/fonts/glyphicons-halflings-regular.woff2
+4 −4 src/public/js/lib/jquery-3.1.1.min.js
+8 −4 src/server.ts
+0 −2 src/types/lusca.d.ts
+0 −48 src/types/passport-local.d.ts
+17 −0 src/util/logger.ts
+26 −0 src/util/secrets.ts
+2 −2 test/api.test.ts
+2 −2 test/app.test.ts
+20 −2 test/contact.test.ts
+2 −2 test/home.test.ts
+20 −2 test/user.test.ts
+1 −0 tsconfig.json
+1 −1 views/account/profile.pug
+1 −1 views/api/facebook.pug
+1 −1 views/api/index.pug
+8 −9 views/layout.pug
+2 −3 views/partials/footer.pug
+2 −2 views/partials/header.pug

0 comments on commit 99ebcd7

Please sign in to comment.