Add package.json catalog support for npm completions and hover#307989
Add package.json catalog support for npm completions and hover#307989yogeshwaran-c wants to merge 3 commits intomicrosoft:mainfrom
Conversation
e63ecff to
a2472a9
Compare
|
Are unrelated changes to AI instruction files. Please remove these. |
There was a problem hiding this comment.
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
a2472a9 to
c43386c
Compare
|
Removed the unrelated AI instruction files. PR now only contains the npm catalog change (1 file, 3 lines). |
|
@aeschli confirming the unrelated AI instruction file changes (including the |
|
Thanks @yogeshwaran-c ! |
There was a problem hiding this comment.
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 matchinglocation.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
Summary
catalogsection inpackage.json, enabling IntelliSense completions, version suggestions, and hover information for packages listed under the catalog keylocation.matches(['catalog'])andlocation.matches(['catalog', '*'])to the three relevant methods inpackageJSONContribution.ts:collectPropertySuggestions,collectValueSuggestions, andgetInfoContributionFixes #294609
Test plan
package.jsonfile that contains acatalogsection (e.g., a pnpm workspace root)"catalog": { }triggers npm package name completionscatalogsection shows package description, latest version, and homepagedependencies,devDependencies,optionalDependencies, andpeerDependenciesbehavior is unchanged