Skip to content

Add fourslash test for JSDoc @this/@param types in JS files - #65307

Open
Harsh Vardhan Chauhan (1-DARK) wants to merge 1 commit into
microsoft:mainfrom
1-DARK:jsdoc-this-param-ls-tests
Open

Harsh Vardhan Chauhan (1-DARK) wants to merge 1 commit into
microsoft:mainfrom
1-DARK:jsdoc-this-param-ls-tests

Conversation

@1-DARK

@1-DARK Harsh Vardhan Chauhan (1-DARK) commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #65167

Summary

Adds a fourslash regression test showing that the native language service already uses JSDoc @this and @param types in JS files for completions, hover, and signature help.

This is a test-only change. It doesn't change any behavior.

Background

#65167 reports that the native LS treats JSDoc @this/@param types as any for completions, hover, and signature help, even though the checker uses them correctly.

The repro in the issue sets @allowJs/@checkJs but has no // @filename: /x.js, so the content isn't treated as JS. In TS files, JSDoc @this/@param types aren't used for typing, so the reported any (and no member completions) is expected there.

With an actual .js file, every scenario from the issue and its follow-up comments already works on main.

Test

tsc/internal/fourslash/tests/jsdocThisAndParamTypesInJs_test.go, in /a.js with @allowJs + @checkJs:

/**
 * @this {{ id: string, click: () => void }}
 * @param {{ name: string }} p
 */
function h(p) {
  this./*thisCompletions*/;
  p./*paramCompletions*/;
}

/**
 * @param {string} a
 * @param {number} b
 */
function f(a, b) {}
f(/*signatureHelp*/);
Feature Marker Expected
Completions (@this) this. exactly click, id
Completions (@param) p. exactly name
Hover (@param) p (parameter) p: { name: string; }
Signature help (@param) f( f(a: string, b: number): void

To confirm the test catches the reported failure, I changed the file to /a.ts. The test then fails with the same error as the issue (At marker 'thisCompletions': Expected completion list but got nil.).

Checklist

Covers completions, hover, and signature help using JSDoc @this and
@PARAM types in a JS file (see microsoft#65167).
Copilot AI balanced review requested due to automatic review settings November 4, 2026 07:13
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Nov 4, 2026
@typescript-automation

Copy link
Copy Markdown
Contributor

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

@typescript-automation typescript-automation Bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Nov 4, 2026
@typescript-automation typescript-automation Bot added For Backlog Bug PRs that fix a backlog bug and removed For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Nov 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the added JavaScript JSDoc regression coverage.

No open issues 🎉

What changed in this PR

Adds regression coverage related to #65167 for JSDoc types in the native language server. The test explicitly uses a JavaScript file and introduces no production behavior changes.

Changes:

  • Checks @this and @param member completions.
  • Verifies parameter hover types and function signature help.
File Description
tsc/​internal/​fourslash/​tests/​jsdocThisAndParamTypesInJs_test.go Adds a fourslash test for JSDoc-based completions, hover, and signature help in JavaScript.

Review effort: Balanced

This branch has not been deployed

No deployments
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.

Native LS: JSDoc @this / @param types are any for hover & completions (checker OK)

2 participants