Skip to content

Handle JSDoc @param with hyphen #20801

Open

Description

@mjbvz

TypeScript Version: 2.7.0-dev.20171214

Code

/**
 * @param x - Bla
 */
function foo(x) { }

Hover over x

Expected behavior:
Hyphen is ignored in any documentation returned. See JSDoc PARAM spec: http://usejsdoc.org/tags-param.html

Actual behavior:
Hyphen is returned as part of documentation:

[Trace  - 2:58:07 PM] Response received: quickinfo (144). Request took 3 ms. Success: true 
Result: {
    "kind": "parameter",
    "kindModifiers": "",
    "start": {
        "line": 4,
        "offset": 14
    },
    "end": {
        "line": 4,
        "offset": 15
    },
    "displayString": "(parameter) x: any",
    "documentation": "- Bla",
    "tags": []
}

Activity

  1. mjbvz commented on Jan 29, 2020

    @mjbvz
    ContributorAuthor

    Nathan Shively-Sanders (@sandersn) TS 3.7.5 returns a response that looks like:

    [Trace  - 22:27:03.14] <semantic> Response received: quickinfo (292). Request took 3 ms. Success: true 
    Result: {
        "kind": "parameter",
        "kindModifiers": "",
        "start": {
            "line": 2,
            "offset": 11
        },
        "end": {
            "line": 2,
            "offset": 12
        },
        "displayString": "(parameter) x: any",
        "documentation": "- Bla",
        "tags": [
            {
                "name": "param",
                "text": "x - Bla"
            }
        ]
    

    This lets us work around the original issue on the VS Code side. Up to you if anything more needs to be done on the TS side (other editors/tooling for example would also have to have code to support removing the hyphen)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Domain: JSDocRelates to JSDoc parsing and type generationExperience EnhancementNoncontroversial enhancementsSuggestionAn idea for TypeScriptVS Code TrackedThere is a VS Code equivalent to this issue

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions