Skip to content

Sort jsdoc parameter suggestions by argument position  #20183

Open

Description

@mjbvz

From microsoft/vscode#35124

TypeScript Version: 2.7.0-dev.20171116

Code

For the code:

/**
 * @param |
 */
function foo(z, a) {}

Trigger completions at the | after @param

Expected behavior:
z is returned first, followed by a. The sortText can be used for this

Actual behavior:
a and z are returned with sort orders weights:

[Trace  - 11:33:07 PM] Sending request: completions (176). Response expected: yes. Current queue length: 0
Arguments: {
    "file": "/Users/matb/projects/san/y.ts",
    "line": 2,
    "offset": 11,
    "includeExternalModuleExports": true
}
[Trace  - 11:33:07 PM] Response received: completions (176). Request took 2 ms. Success: true 
Result: [
    {
        "name": "a",
        "kind": "parameter",
        "kindModifiers": "",
        "sortText": "0"
    },
    {
        "name": "z",
        "kind": "parameter",
        "kindModifiers": "",
        "sortText": "0"
    }
]

Activity

  1. added this to the milestone on Nov 21, 2017
  2. mhegazy commented on Nov 21, 2017

    @mhegazy
    Contributor

    PRs welcomed.

  3. bmsdave commented on Dec 26, 2017

    @bmsdave

    Matt Bierner (@mjbvz) tell me how to reproduce this situation, plz.
    Where can I see the trace that is specified in the issue description?
    [Trace - 11:33:07 PM] Sending request ***

  4. mjbvz commented on Jan 2, 2018

    @mjbvz
    ContributorAuthor
    1. In your vscode user settings, set "typescript.tsserver.trace": "verbose".
    2. Open output panel and go to the TypeScript section
  5. SimonGustavsson commented on Oct 10, 2018

    @SimonGustavsson

    Is this still an issue? I tried this:

    /** */
    public test(b: number, a: number) {
        console.log(a);
        console.log(b);
    }

    with the caret placed after ** auto complete shows a completion of "JSDoc comment", hitting Return produces this, with the caret placed after @param b

    /**
     * 
     * @param b 
     * @param a 
     */
    public test(b: number, a: number) {
        console.log(a);
        console.log(b);
    }
  6. mjbvz commented on Oct 11, 2018

    @mjbvz
    ContributorAuthor

    Yes. It is correct when using a template to generate the doc comment. This issue tracks the sort order when you trigger suggestions after @param.

  7. shonnungar commented on Oct 1, 2020

    @shonnungar

    Looking into this issue

  8. ckcherry23 commented on Dec 9, 2023

    @ckcherry23

    Hi Matt Bierner (@mjbvz), I'm a first-time contributor. Is this issue still relevant to take up?

  9. RafaelMeir4 commented on Jan 19, 2025

    @RafaelMeir4

    Hi Matt Bierner (@mjbvz), Mohamed Hegazy (@mhegazy), Nathan Shively-Sanders (@sandersn), Ryan Cavanaugh (@RyanCavanaugh), This is my first time contributing to an open-source project, and I’m really excited to start! I’ve read the issue and I’m planning to go through the contribution guidelines to make sure I follow the process correctly. I’d like to work on this issue if it’s still relevant.

    Before I dive in, I wanted to ask:

    Is this issue still a priority, or has it already been resolved in recent updates?
    Could you point me to the folder or file where the related logic is implemented, so I can start exploring the codebase?
    I’ve already checked the repository and have some ideas about where to start, but any pointers would help me focus my efforts.

    Thank you in advance for your guidance, and I’m looking forward to contributing!

  10. added a commit that references this issue on Feb 2, 2026
    80c6a81
  11. ManishPrakkash commented on Mar 16, 2026

    @ManishPrakkash

    Checking in to see if this is still open for a PR? I’d like to help out with the requested changes

  12. added a commit that references this issue on Mar 27, 2026
  13. added a commit that references this issue on Apr 18, 2026
    4f89210
  14. LeonxLJX commented on Sep 1, 2026

    @LeonxLJX

    I'd like to take this one (Sort jsdoc parameter suggestions by argument position). I'll look into the root cause and follow up with a PR. (claiming via Stella (@LeonxLJX))

  15. LeonxLJX commented on Sep 1, 2026

    @LeonxLJX

    I'd like to take this one (Sort jsdoc parameter suggestions by argument position). I'll dig into the root cause and follow up with a PR shortly. (claiming via Stella (@LeonxLJX))

  16. LeonxLJX commented on Sep 1, 2026

    @LeonxLJX

    I'd like to take this one (Sort jsdoc parameter suggestions by argument position). I'll look into the root cause and follow up with a PR. (claiming via Stella (@LeonxLJX))

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: LS: Completion ListsThe issue relates to showing completion lists in an editorGood First IssueWell scoped, documented and has the green lightHelp WantedYou can do thisSuggestionAn 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