Skip to content

Quick info & find-all-refs tests for JSDoc namespaces#4078

Open
DanielRosenwasser wants to merge 12 commits into
mainfrom
addTestTo4073
Open

Quick info & find-all-refs tests for JSDoc namespaces#4078
DanielRosenwasser wants to merge 12 commits into
mainfrom
addTestTo4073

Conversation

@DanielRosenwasser
Copy link
Copy Markdown
Member

@DanielRosenwasser DanielRosenwasser commented May 30, 2026

Follow up to #4073

Copilot AI review requested due to automatic review settings May 30, 2026 00:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the TypeScript-go port’s JSDoc namespace support by parsing dotted @typedef/@callback names as namespace chains and ensuring those reparsed declarations participate correctly in symbol visibility, Quick Info, and Find-all-references. It also adds new compiler + fourslash baselines/tests to lock in the language-service behavior, and updates impacted submodule baselines.

Changes:

  • Parse dotted JSDoc names (NS.T, A.B.C) into namespace-shaped AST and wrap reparsed typedef/callback aliases into corresponding namespace declarations.
  • Adjust “implicitly exported JSDoc declaration” handling so reparsed namespace wrappers behave as module-visible where appropriate.
  • Add/refresh compiler and fourslash baselines for Quick Info verbosity + FindAllRefs on namespaced JSDoc typedefs; update affected submodule baselines/acceptance lists.
Show a summary per file
File Description
testdata/tests/cases/compiler/jsDocTypedefTagNamespace.ts New compiler test covering namespaced @typedef/@callback and cross-file import type usage.
testdata/submoduleAccepted.txt Removes an accepted submodule .diff entry that’s no longer needed.
testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportNamespacedType.js.diff Updates accepted baseline diff for namespaced typedef declaration emit.
testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.js.diff Updates accepted baseline diff for namespaced typedefs affecting CJS declaration emit.
testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespace.js.diff Updates accepted baseline diff for namespaced typedefs affecting ESM declaration emit.
testdata/baselines/reference/submoduleAccepted/conformance/callbackTagNamespace.types.diff Deletes now-unneeded accepted .diff for callback namespace types.
testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.types.diff Deletes now-unneeded .diff baseline.
testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.types Updates reference baseline showing corrected resolved type for imported namespaced typedef.
testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.js Updates reference baseline d.ts emit structure for namespaced typedef.
testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.errors.txt.diff Deletes now-unneeded .diff baseline.
testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.errors.txt Deletes reference error baseline (errors resolved).
testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types.diff Updates reference .diff for type changes due to fixed namespaced resolution.
testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types Updates reference types baseline for CJS case.
testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols.diff Updates reference .diff for symbol output changes.
testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols Updates reference symbols baseline for CJS case.
testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.js Updates reference d.ts emit baseline for CJS case.
testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff Deletes now-unneeded .diff baseline.
testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt Deletes reference error baseline (errors resolved).
testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.types.diff Updates reference .diff for ESM case types changes.
testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.types Updates reference types baseline for ESM case.
testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols.diff Updates reference .diff for symbol changes.
testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols Updates reference symbols baseline for ESM case.
testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.js Updates reference d.ts emit baseline for ESM case.
testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt.diff Updates reference .diff around error output becoming empty.
testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt Deletes reference error baseline (errors resolved).
testdata/baselines/reference/submodule/conformance/callbackTagNamespace.types Updates reference types baseline reflecting corrected callback namespace typing.
testdata/baselines/reference/submodule/conformance/callbackTagNamespace.errors.txt.diff Deletes now-unneeded .diff baseline.
testdata/baselines/reference/submodule/conformance/callbackTagNamespace.errors.txt Deletes reference error baseline (errors resolved).
testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.types.diff Updates reference .diff for compiler baseline impacted by the change set.
testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.types Updates reference types baseline for js enum cross-file export scenario.
testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols.diff Updates reference .diff for symbol output changes.
testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols Updates reference symbols baseline.
testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt.diff Updates reference .diff for changed diagnostics.
testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt Updates reference errors baseline for changed diagnostics.
testdata/baselines/reference/fourslash/quickInfo/quickInfoVerbosityJSDocNamespacedTypedef.baseline New fourslash baseline for Quick Info verbosity on namespaced typedefs.
testdata/baselines/reference/fourslash/findAllReferences/findAllRefsJSDocNamespacedTypedef.baseline.jsonc New fourslash baseline for find-all-refs on namespaced typedef symbols.
testdata/baselines/reference/compiler/jsDocTypedefTagNamespace.types New compiler baseline: types output for new test case.
testdata/baselines/reference/compiler/jsDocTypedefTagNamespace.symbols New compiler baseline: symbols output for new test case.
testdata/baselines/reference/compiler/jsDocTypedefTagNamespace.js New compiler baseline: JS emit output for new test case.
internal/transformers/declarations/transform.go Uses new “implicitly exported JSDoc declaration” predicate for modifier handling in d.ts emit.
internal/parser/reparser.go Wraps reparsed typedef/callback aliases in namespace declarations; adds helper utilities for export modifiers and namespace wrapping.
internal/parser/jsdoc.go Parses dotted JSDoc names into namespace-like AST structures.
internal/ls/importTracker.go Updates export detection to include implicitly exported JSDoc declarations.
internal/fourslash/tests/quickinfoVerbosityJSDocNamespacedTypedef_test.go New fourslash test for Quick Info verbosity on namespaced typedefs.
internal/fourslash/tests/findAllRefsJSDocNamespacedTypedef_test.go New fourslash test for find-all-refs on namespaced typedefs.
internal/fourslash/_scripts/failingTests.txt Removes a test from the known-failing list (now expected to pass).
internal/checker/symbolaccessibility.go Uses reparsed-node mapping to improve symbol accessibility checks with JSDoc reparsing.
internal/checker/emitresolver.go Expands declaration visibility logic (including export specifier visibility) and updates implicit export predicate usage.
internal/binder/binder.go Updates implicit export predicate usage; changes source-file member declaration logic (see review comment).
internal/ast/utilities.go Replaces IsImplicitlyExportedJSTypeAlias with IsImplicitlyExportedJSDocDeclaration; updates node-position comparison.
internal/ast/nodeflags.go Adds NodeFlags for JSDoc namespace parsing metadata.
internal/ast/ast.go Adds TypeExpression() support for JSDocCallbackTag.
internal/ast/ast_generated.go Extends JSDoc typedef/callback name types to support namespaced forms.
internal/api/encoder/encoder_generated.go Updates encoder child-mask for JSDoc callback tag name field.
internal/api/encoder/decoder_generated.go Updates decoder for JSDoc callback tag name field.
CHANGES.md Removes the “unsupported” entry for nested @typedef names now that behavior is implemented.
_scripts/ast.json AST schema update to model namespaced JSDoc names (JSDocFullName).
_packages/native-preview/src/enums/nodeFlags.ts Syncs new NodeFlags for the native preview package.
_packages/native-preview/src/enums/nodeFlags.enum.ts Syncs new NodeFlags enum mapping for the native preview package.
_packages/native-preview/src/ast/visitor.generated.ts Updates visitor generation to use isJSDocFullName for JSDoc typedef/callback tags.
_packages/native-preview/src/ast/is.generated.ts Adds isJSDocFullName type guard.
_packages/native-preview/src/ast/factory.generated.ts Updates factory/cloning for renamed JSDoc callback tag name field.
_packages/native-preview/src/ast/ast.generated.ts Updates AST typings (JSDocFullName) for namespaced JSDoc names.
_packages/native-preview/src/api/node/protocol.generated.ts Updates protocol child-property list for JSDoc callback tag (name vs fullName).
_packages/native-preview/src/api/node/node.generated.ts Removes the old fullName RemoteNode accessor.

Copilot's findings

Files not reviewed (3)
  • internal/api/encoder/decoder_generated.go: Language not supported
  • internal/api/encoder/encoder_generated.go: Language not supported
  • internal/ast/ast_generated.go: Language not supported
  • Files reviewed: 62/65 changed files
  • Comments generated: 1

Comment thread internal/binder/binder.go
Comment on lines 428 to 432
func (b *Binder) declareSourceFileMember(node *ast.Node, symbolFlags ast.SymbolFlags, symbolExcludes ast.SymbolFlags) *ast.Symbol {
if ast.IsExternalOrCommonJSModule(b.file) {
if ast.IsExternalModule(b.file) {
return b.declareModuleMember(node, symbolFlags, symbolExcludes)
}
return b.declareSymbol(ast.GetLocals(b.file.AsNode()), nil /*parent*/, node, symbolFlags, symbolExcludes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants