Skip to content

Conversation

@jayinmt
Copy link

@jayinmt jayinmt commented Oct 27, 2025

Fixes #20183

Summary

  • JSDoc @param name completions now appear in the same order as the function’s parameters.
  • Keeps sortText at Completions.SortText.LocationPriority; relies on response order for ties (avoids changing existing sortText-sensitive tests).
  • Applies to TS and JS; aligns ad‑hoc completions with the /** doc template expansion.

Approach

  • Update getJSDocParameterNameCompletions to:
    • Return entries in parameter declaration order.
    • Skip non-identifier params (e.g., destructured).
    • Filter already-documented params.
    • Respect prefix filtering.

Changed:

  • src/services/jsDoc.ts (getJSDocParameterNameCompletions)

Tests

Added deterministic fourslash tests (no manual blocks):

  • tests/cases/fourslash/jsDocParamCompletion_filterAlreadyDocumented.ts
  • tests/cases/fourslash/jsDocParamCompletion_prefixFiltering.ts
  • tests/cases/fourslash/jsDocParamCompletion_skipDestructured.ts
  • tests/cases/fourslash/jsDocParamCompletion_optionalAndRest.ts
  • tests/cases/fourslash/jsDocParamCompletion_overloadsUseImplementation.ts
  • tests/cases/fourslash/jsDocParamCompletion_jsFile.ts

Existing related tests still pass:

  • tests/cases/fourslash/completionsJsdocParamTypeBeforeName.ts
  • tests/cases/fourslash/jsdocParameterNameCompletion.ts

Risk/compatibility

  • Low; localized to JSDoc @param completions. No API or language changes.

Performance

  • Negligible; single pass over parameters.

Editor impact

  • Editors will show @param name suggestions in declaration order when completing after @param.

@github-project-automation github-project-automation bot moved this to Not started in PR Backlog Oct 27, 2025
@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Oct 27, 2025
@jayinmt
Copy link
Author

jayinmt commented Oct 27, 2025

@microsoft-github-policy-service agree

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

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

Sort jsdoc parameter suggestions by argument position

2 participants