Skip to content

Add "item size" to toggle between rows / cards for the Packages pane#13156

Open
bricestacey wants to merge 7 commits intomainfrom
12925/packages-card-view
Open

Add "item size" to toggle between rows / cards for the Packages pane#13156
bricestacey wants to merge 7 commits intomainfrom
12925/packages-card-view

Conversation

@bricestacey
Copy link
Copy Markdown
Contributor

See #12925

Adds "Item Size" action button to the Packages pane.

  • Toggles between two views: One that looks like a row and the other a card.
  • Adds description and authorship metadata to the get packages API.
  • For python, authorship is not a simple lookup but some combination of author -> author email -> maintainer -> maintainer email

This PR adds ark support to supplement R packages posit-dev/ark#1165

Screenshot 2026-04-22 at 2 01 27 PM

Release Notes

New Features

  • Add support for card / row views on the Packages pane.
  • Add additional metadata including description and author to the Packages pane.

Bug Fixes

  • N/A

QA Notes

Until the ark PR lands, you'll want to build that.
Otherwise, you can test for python.
When you expand to card view, everything should kinda just stay the same but turn into cards.

@:packages-pane

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 22, 2026

E2E Tests 🚀
This PR will run tests tagged with: @:critical @:packages-pane

readme  valid tags

Introduces a 'card' item size mode alongside the existing compact row
layout. Cards show the package name and version on the first line, a
description on the second, and the author on the third, with long values
truncated to a single line. The mode is toggled from the view title
(Show as Cards / Show as Rows) or via the 'Toggle Packages List Layout'
command and persisted per-user.

Python and R RPCs now return description and author fields populated
from distribution metadata and DESCRIPTION, respectively.

See #12925
- Expose `author?` on the public LanguageRuntimePackage API so extensions
  can populate what the cards render.
- Python: fall back through Author, Author-email, Maintainer, and
  Maintainer-email, stripping trailing `<email>` so packages that only
  set a maintainer (e.g. click -> "Pallets") still show one.
- Persist the card/row preference in profile storage instead of
  application-wide storage.
- Search filter now matches description and author in addition to name.
- Tighten the card's left padding.

See #12925
Drop the IStorageService integration so the item size resets to 'row'
on each window. We can revisit persistence (profile vs. workspace, or
with additional state) in a follow-up.

See #12925
Drop the `_itemSize` field on PositronPackagesService; read through
`_itemSizeContextKey.get()` instead. The RawContextKey's default
supplies the initial 'row' value.

See #12925
PackageMetadata (the protocol typing importlib.metadata.Distribution.metadata
in 3.14) doesn't expose .get(), so pyright rejects the calls that parse
Summary/Author/Maintainer. The runtime object (email.message.Message) still
has .get(); bind it through an Any local so the calls pass type-checking.

See #12925
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

Adds an “Item Size” toggle to the Positron Packages view so users can switch between a compact row layout and an expanded card layout that shows additional package metadata. This extends the runtime package model/API to include description and author information and wires the new layout into the Packages UI.

Changes:

  • Add row/card layout toggles (View Title actions + command palette toggle) and propagate layout state through the packages service.
  • Extend package metadata with description and author, and include these fields in filtering + card rendering.
  • Populate Python package description/author from distribution metadata with reasonable fallbacks.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/vs/workbench/services/runtimeSession/common/runtimeSessionService.ts Extends ILanguageRuntimePackage with description/author.
src/vs/workbench/contrib/positronPackages/browser/positronPackagesService.ts Tracks item size state via context key + emits change events for UI.
src/vs/workbench/contrib/positronPackages/browser/positronPackagesContextKeys.ts Adds positronPackages.itemSize context key and PackagesItemSize type.
src/vs/workbench/contrib/positronPackages/browser/positronPackages.contribution.ts Registers actions/commands to switch between row/card layouts.
src/vs/workbench/contrib/positronPackages/browser/interfaces/positronPackagesService.ts Exposes item size API and change event on the service interface.
src/vs/workbench/contrib/positronPackages/browser/components/listPackages.tsx Renders row vs card layout, filters by description/author, updates list item heights.
src/vs/workbench/contrib/positronPackages/browser/components/listPackages.css Adds styling for row/card layouts and card metadata lines.
src/positron-dts/positron.d.ts Updates public typings to include description/author for packages.
extensions/positron-python/python_files/posit/positron/ui.py Adds Python backend fields for package description/author.

Comment thread src/vs/workbench/contrib/positronPackages/browser/components/listPackages.css Outdated
bricestacey and others added 2 commits April 27, 2026 12:40
…ositronPackagesService.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Brice Stacey <bricestacey@gmail.com>
- Add JSDoc to ILanguageRuntimePackage description/author fields
- Fix misleading CSS comment about card padding alignment
- Revert filter scope to name/displayName only (description/author
  matches surprised users in row mode where the field isn't visible)
@softwarenerd
Copy link
Copy Markdown
Contributor

For the sorting option:

image

Why don't we follow VS Code's lead here and rename the "Sort" context menu item to "Sort By":

image

@softwarenerd
Copy link
Copy Markdown
Contributor

When I expand packages using "Show as Rows", I see:

image

The entries turn into "rows", and are bigger, but they don't contain any additional information.

@softwarenerd
Copy link
Copy Markdown
Contributor

I'd add a little "air" above and below the "Filter packages" box, as well as a bottom border:

image

So the scrollbar tops out at a border, which it doesn't now:

image

Copy link
Copy Markdown
Contributor

@softwarenerd softwarenerd left a comment

Choose a reason for hiding this comment

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

I approve of the code. I left some notes for things I ran into and observed.

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.

3 participants