Skip to content

Support jsdoc @ linkcode and @ linkplain variations of @ link #43935

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

Closed
mjbvz opened this issue May 3, 2021 · 2 comments Β· Fixed by #44208
Closed

Support jsdoc @ linkcode and @ linkplain variations of @ link #43935

mjbvz opened this issue May 3, 2021 · 2 comments Β· Fixed by #44208
Assignees
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Fix Available A PR has been opened for this issue Suggestion An idea for TypeScript VS Code Priority Critical issues that VS Code needs fixed in the current TypeScript milestone

Comments

@mjbvz
Copy link
Contributor

mjbvz commented May 3, 2021

Bug Report

πŸ”Ž Search Terms

  • jsdoc
  • link
  • see

πŸ•— Version & Regression Information

4.3.0-dev.20210503

⏯ Playground Link

Playground link with relevant code

Request

JSDoc has two variants of @link:

  • @linkcode for code links
  • @linkplain for plain text links

https://jsdoc.app/tags-inline-link.html

For example:

/**
 * {@linkcode foo}
 */
function foo(): { a: number; } {
    return {a: 1}
}

These variants currently don't seem to be parsed by TS. We'd like these to be treated as links too. I imagine the documentation result from TSServer could simply change from having {@link to {@linkcode on the opening link token, and leave all the formatting up the the editor:

 "documentation": [
        {
            "text": "",
            "kind": "text"
        },
        {
            "text": "{@linkcode ",
            "kind": "link"
        },
        {
            "text": "foo",
            "kind": "linkName",
            "target": {
                "file": "/Users/matb/projects/san/x.tsx",
                "start": {
                    "line": 15,
                    "offset": 4
                },
                "end": {
                    "line": 17,
                    "offset": 2
                }
            }
        },
        {
            "text": "}",
            "kind": "link"
        }
    ],
@RyanCavanaugh RyanCavanaugh added Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript labels May 6, 2021
@mjbvz
Copy link
Contributor Author

mjbvz commented May 11, 2021

This pattern is being pretty heavily used in the jquery d.ts file:

     * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`

I think it's trying to enclose the link inside inline code.

In the VS Code codebase, we also have a few definitions that are written as:

* {@link Foo `Foo`}

I believe @linkcode would be clearer in both cases

/cc @sandersn

@mjbvz mjbvz added the VS Code Priority Critical issues that VS Code needs fixed in the current TypeScript milestone label May 21, 2021
@mjbvz
Copy link
Contributor Author

mjbvz commented May 21, 2021

Marking this as a priority for VS Code since I believe this is a small fix that would have a nice positive impact for us

@sandersn sandersn self-assigned this May 21, 2021
@sandersn sandersn added this to the TypeScript 4.4.0 milestone May 21, 2021
sandersn added a commit that referenced this issue May 21, 2021
They are just like @link tags but request fixed-width and normal
presentation, respectively.

Fixes #43935
@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label May 21, 2021
sandersn added a commit that referenced this issue May 24, 2021
* Add @linkcode and @linkplain tags

They are just like @link tags but request fixed-width and normal
presentation, respectively.

Fixes #43935

* revert JSDocComment -> JSDoc SyntaxKind rename

* update API baselines

* fix lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Fix Available A PR has been opened for this issue Suggestion An idea for TypeScript VS Code Priority Critical issues that VS Code needs fixed in the current TypeScript milestone
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants