Skip to content

Add package.json catalog support for npm completions and hover#307989

Open
yogeshwaran-c wants to merge 3 commits intomicrosoft:mainfrom
yogeshwaran-c:feat/npm-catalog-support
Open

Add package.json catalog support for npm completions and hover#307989
yogeshwaran-c wants to merge 3 commits intomicrosoft:mainfrom
yogeshwaran-c:feat/npm-catalog-support

Conversation

@yogeshwaran-c
Copy link
Copy Markdown
Contributor

@yogeshwaran-c yogeshwaran-c commented Apr 6, 2026

Summary

  • Extends the npm extension to recognize the catalog section in package.json, enabling IntelliSense completions, version suggestions, and hover information for packages listed under the catalog key
  • Supports the catalog feature used by pnpm, bun, and yarn for centralizing dependency versions in monorepos
  • Adds location.matches(['catalog']) and location.matches(['catalog', '*']) to the three relevant methods in packageJSONContribution.ts: collectPropertySuggestions, collectValueSuggestions, and getInfoContribution

Fixes #294609

Test plan

  • Open a package.json file that contains a catalog section (e.g., a pnpm workspace root)
  • Verify that typing a package name inside "catalog": { } triggers npm package name completions
  • Verify that typing a version value for a catalog entry triggers version suggestions (latest, ^latest, ~latest)
  • Verify that hovering over a package name in the catalog section shows package description, latest version, and homepage
  • Verify that existing dependencies, devDependencies, optionalDependencies, and peerDependencies behavior is unchanged

@aeschli
Copy link
Copy Markdown
Contributor

aeschli commented Apr 7, 2026

Are unrelated changes to AI instruction files. Please remove these.

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.

Should not be included in this PR.

Extend the npm extension to recognize the `catalog` section in
package.json, enabling IntelliSense completions, version suggestions,
and hover information for packages listed under the catalog key.
This supports the catalog feature used by pnpm, bun, and yarn for
centralizing dependency versions in monorepos.

Fixes microsoft#294609
@yogeshwaran-c yogeshwaran-c force-pushed the feat/npm-catalog-support branch from a2472a9 to c43386c Compare April 8, 2026 08:41
@yogeshwaran-c
Copy link
Copy Markdown
Contributor Author

Removed the unrelated AI instruction files. PR now only contains the npm catalog change (1 file, 3 lines).

@yogeshwaran-c
Copy link
Copy Markdown
Contributor Author

@aeschli confirming the unrelated AI instruction file changes (including the aiCustomizationTreeViewViews.ts:450 change you flagged inline) were already removed in b7c5f13gh pr view 307989 --json files now shows only extensions/npm/src/features/packageJSONContribution.ts (3 additions / 3 deletions). PR is approved and ready when you have a chance to merge. Thanks for the review!

@aeschli aeschli enabled auto-merge (squash) April 29, 2026 08:28
Copilot AI review requested due to automatic review settings April 29, 2026 08:28
@aeschli
Copy link
Copy Markdown
Contributor

aeschli commented Apr 29, 2026

Thanks @yogeshwaran-c !

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

Extends the built-in npm extension’s package.json IntelliSense logic to treat a top-level catalog object like other dependency sections, enabling package-name completions, version value suggestions, and package hover info inside catalog entries.

Changes:

  • Enable npm package-name completion within "catalog": { ... } by matching location.matches(['catalog']).
  • Enable version suggestions and hover info for catalog entries by matching location.matches(['catalog', '*']) in the relevant code paths.
Show a summary per file
File Description
extensions/npm/src/features/packageJSONContribution.ts Adds catalog / catalog/* to the same location-matching checks used for dependency name completions, version suggestions, and hover info.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

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.

Package.json catalog version tooltips

4 participants