microsoft / microsoft/TypeScript

Sort jsdoc parameter suggestions by argument position

Open Beginner friendly
#20,183 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Domain: LS: Completion Lists Good First Issue Help Wanted Suggestion VS Code Tracked
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

From https://github.com/Microsoft/vscode/issues/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"
    }
]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the TypeScript language-service completion entry point for JSDoc @param suggestions and reproduce the example with function foo(z, a). Adjust the completion ordering so parameters follow argument position, then verify that z is returned before a and that sortText reflects this ordering.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.