Quick info & find-all-refs tests for JSDoc namespaces#4078
Open
DanielRosenwasser wants to merge 12 commits into
Open
Quick info & find-all-refs tests for JSDoc namespaces#4078DanielRosenwasser wants to merge 12 commits into
DanielRosenwasser wants to merge 12 commits into
Conversation
Contributor
There was a problem hiding this comment.
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 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) |
ahejlsberg
approved these changes
May 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow up to #4073