Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
72f19ef
Initial scribbles
sandersn Sep 10, 2020
c08258b
Compiles but provides spans instead of location pairs
sandersn Sep 11, 2020
2f1d113
Switch to DocumentSpan
sandersn Sep 11, 2020
256a60a
Merge branch 'master' into editor-support-for-links
sandersn Nov 24, 2020
8ba5dc8
Builds w/protocol types + conversions
sandersn Nov 24, 2020
ca1b273
cleanup:better names and scrub TODOs
sandersn Nov 24, 2020
867ab34
fix test harness too
sandersn Nov 30, 2020
5d518d6
Misc
sandersn Nov 30, 2020
c07fe40
Parse and store links in the compiler
sandersn Dec 2, 2020
82c11fe
Merge branch 'master' into editor-support-for-links
sandersn Dec 3, 2020
90feb3e
more tests and some fixes
sandersn Dec 3, 2020
035bb4a
Merge branch 'master' into editor-support-for-links
sandersn Dec 4, 2020
fc813c2
Fix other failing tests
sandersn Dec 7, 2020
917314c
Merge branch 'master' into editor-support-for-links
sandersn Dec 7, 2020
7dd7cab
fix bad merge
sandersn Dec 7, 2020
c0e8d47
polish parser
sandersn Dec 7, 2020
8bbc8b4
improve names and array types
sandersn Dec 8, 2020
070da0b
slight tweaks
sandersn Dec 8, 2020
fce33f1
remove some done TODOs
sandersn Dec 8, 2020
7ac40d4
more tests + resulting fixes
sandersn Dec 8, 2020
6b1d4ce
add+fix cross-module tests
sandersn Dec 8, 2020
e4f111e
Support `@see {@link`
sandersn Dec 8, 2020
64baa18
add server test
sandersn Dec 8, 2020
681cc64
Merge branch 'master' into editor-support-for-links
sandersn Dec 8, 2020
c307c03
Make comments actually part of the AST
sandersn Dec 11, 2020
1a3e95b
Add span for link.name in language service/protocol
sandersn Dec 11, 2020
6631745
Merge branch 'master' into editor-support-for-links
sandersn Dec 14, 2020
ce966fc
Make checker optional in getJSDocTags
sandersn Dec 14, 2020
fdb67a6
Use getTokenValue instead of getTokenText
sandersn Dec 14, 2020
543b6ab
Add missing support for top-level links
sandersn Dec 15, 2020
36b1224
add string back to comment type in node constructors
sandersn Dec 15, 2020
38100f9
Merge branch 'master' into editor-support-for-links
sandersn Dec 18, 2020
d90244e
Merge branch 'master' into editor-support-for-links
sandersn Feb 18, 2021
bfefd33
Full parse of link tags and jsdoc comment text
sandersn Feb 24, 2021
d216e93
fix lint
sandersn Feb 24, 2021
6b2bd81
Fix missing newlines in inferFromUsage codefix
sandersn Feb 25, 2021
1f1250e
Merge branch 'master' into editor-support-for-links
sandersn Mar 2, 2021
3c35584
Merge branch 'master' into editor-support-for-links
sandersn Mar 3, 2021
6bdd493
Merge branch 'master' into editor-support-for-links
sandersn Mar 3, 2021
624c8f7
Parse jsdoc comments as text node/link array
sandersn Mar 3, 2021
6dbc6ce
Fix fourslash tests
sandersn Mar 3, 2021
ff2aba6
Improve types and documentation
sandersn Mar 3, 2021
8c5c650
Test+fix @link emit, scrub other TODOs
sandersn Mar 3, 2021
f93e131
update API baselines
sandersn Mar 4, 2021
c67946e
test that goto-def works with @link
sandersn Mar 4, 2021
36aa091
Split link displaypart into 3
sandersn Mar 5, 2021
c3883b7
update baselines
sandersn Mar 5, 2021
89e4955
Provide JSDocTagInfo.text: string to full clients by default
sandersn Mar 5, 2021
52d64db
Real server tests
sandersn Mar 8, 2021
5a21851
Disambiguate {@link} and @param x {type}
sandersn Mar 8, 2021
ab340f4
Add explanatory comment in test
sandersn Mar 8, 2021
3e5aa10
Merge branch 'master' into editor-support-for-links
sandersn Mar 8, 2021
618bcec
Merge branch 'master' into editor-support-for-links
sandersn Mar 10, 2021
5a29c2e
fix location in richResponse in protocol
sandersn Mar 10, 2021
67c4966
update API baseline
sandersn Mar 10, 2021
2da204a
Merge branch 'master' into editor-support-for-links
sandersn Mar 16, 2021
d0f3048
Address PR comments
sandersn Mar 16, 2021
4cfdaee
use arraysEqual from core
sandersn Mar 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
polish parser
  • Loading branch information
sandersn committed Dec 7, 2020
commit c0e8d4795105683b15b5be14e94a87ab638cc810
23 changes: 8 additions & 15 deletions src/compiler/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7305,7 +7305,6 @@ namespace ts {
state = JSDocState.BeginningOfLine;
indent = 0;
}
// TODO: Need to parse link tags in the initial comment text too
loop: while (true) {
switch (token()) {
case SyntaxKind.AtToken:
Expand Down Expand Up @@ -7354,11 +7353,9 @@ namespace ts {
case SyntaxKind.EndOfFileToken:
break loop;
case SyntaxKind.OpenBraceToken:
// TODO: Refactor in the same way as the other parser, and probably dedupe into a single function
if (lookAhead(() => nextTokenJSDoc() === SyntaxKind.AtToken && tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && scanner.getTokenText() === "link")) {
state = JSDocState.SavingComments;
// TODO: Maybe shouldn't use 1 as the length of { ?
const link = parseLink(scanner.getTextPos() - 1);
state = JSDocState.SavingComments;
const link = parseLink(scanner.getTextPos() - 1);
if (link) {
links.push(link);
pushComment(scanner.getText().slice(link.pos, link.end));
break;
Expand Down Expand Up @@ -7392,7 +7389,6 @@ namespace ts {
}

function createJSDocComment(): JSDoc {
// TODO: Parse links too!
const comment = comments.length ? { links, text: comments.join("") } : undefined;
const tagsArray = tags && createNodeArray(tags, tagsPos, tagsEnd);
return finishNode(factory.createJSDocComment(comment, tagsArray), start, end);
Expand Down Expand Up @@ -7584,11 +7580,8 @@ namespace ts {
break;
case SyntaxKind.OpenBraceToken:
state = JSDocState.SavingComments;
// TODO: test margins
// TODO: Put a manual `tok = nextTokenJSDoc()` here and only call `lookAhead` if its AtToken.
// THat means I'll have to save getTextPos *before* the nextTokenJSDoc and unconditionally `continue` afterward
if (lookAhead(() => nextTokenJSDoc() === SyntaxKind.AtToken && tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && scanner.getTokenText() === "link")) {
const link = parseLink(scanner.getTextPos() - 1);
const link = parseLink(scanner.getTextPos() - 1);
if (link) {
links.push(link);
pushComment(scanner.getText().slice(link.pos, link.end));
}
Expand Down Expand Up @@ -7630,9 +7623,9 @@ namespace ts {
}

function parseLink(start: number) {
nextTokenJSDoc(); // @
nextTokenJSDoc(); // link

if (!tryParse(() => nextTokenJSDoc() === SyntaxKind.AtToken && tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && scanner.getTokenText() === "link")) {
return undefined;
}
nextTokenJSDoc(); // start at token after link, then skip any whitespace
skipWhitespace();
// parseEntityName logs an error for non-identifier, so create a MissingNode ourselves to avoid the error
Expand Down