Skip to content

Add help button to the packages pane#13499

Merged
bricestacey merged 7 commits into
mainfrom
12773/packages-help-link
May 22, 2026
Merged

Add help button to the packages pane#13499
bricestacey merged 7 commits into
mainfrom
12773/packages-help-link

Conversation

@bricestacey
Copy link
Copy Markdown
Contributor

See #12773

This adds a help button next to each item in the packages pane. Currently, it only supports attached packages. In the case of the packages pane, these are items with a green dot next to them.

Screenshot 2026-05-11 at 11 20 10 AM

Release Notes

New Features

  • Add help button to attached packages in the Packages pane

Bug Fixes

  • N/A

Validation Steps

First, you must attach a package to the runtime using your usual import cowsay or library(cowsay)
You'll then need to refresh the packages list.
Finally, the button should appear.

@:help @:packages-pane

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 11, 2026

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

readme  valid tags

@bricestacey bricestacey force-pushed the 12773/packages-help-link branch 2 times, most recently from 217950a to 1e6a6da Compare May 11, 2026 16:45
Copy link
Copy Markdown
Member

@jennybc jennybc left a comment

Choose a reason for hiding this comment

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

With the caveat that I'm just reacting to the screenshot (I haven't test driven this), I think R folks expect to be taken to a package's help index, as opposed to the package-level help topic. I think this PR is going to the latter (?). Probably the clearest way to see what I mean is to do the equivalent move in RStudio.

@bricestacey
Copy link
Copy Markdown
Contributor Author

With the caveat that I'm just reacting to the screenshot (I haven't test driven this), I think R folks expect to be taken to a package's help index, as opposed to the package-level help topic. I think this PR is going to the latter (?). Probably the clearest way to see what I mean is to do the equivalent move in RStudio.

You're correct. This uses the Positron help service, which most closely resembles the behavior for ?. I think we have two options:

Option 1:

  • If the current language is R, we can instead call ??package silently in the console, which opens the help index.
  • Otherwise, default to the help service.

Option 2:

  • Go with what this PR does and create follow-up tickets to resolve the inconsistent expectations.

@jennybc
Copy link
Copy Markdown
Member

jennybc commented May 11, 2026

My guess is that opening the help index is a pretty high priority for R users. It turns out most of us don't know about (or forget) the ?? trick and have various weird workarounds for accessing the help index, which is legitimately useful. So I can imagine this is a real reason some folks like the packages pane.

Update: I just assumed ?? opened the help index when I wrote this but that's not true, so I struck it out.

I am agnostic whether to solve in this PR or a subsequent one.

@jennybc
Copy link
Copy Markdown
Member

jennybc commented May 11, 2026

Somewhat related to #9062

@bricestacey bricestacey requested a review from softwarenerd May 11, 2026 19:46
@bricestacey bricestacey force-pushed the 12773/packages-help-link branch 2 times, most recently from 107ef99 to de7d3b4 Compare May 11, 2026 21:03
@bricestacey
Copy link
Copy Markdown
Contributor Author

Option 1:

If the current language is R, we can instead call ??package silently in the console, which opens the help index.
Otherwise, default to the help service.

I went ahead and did this, but it feels weird to me. ?? is actually just plain-old search... So, it's like just searching for the package's name. Is that really what people really want? On the other hand, I noticed the default package help pages are mostly useless as it only includes some cover page without any further links to dig deeper.

Here is an example when I do ??datasets:

Screenshot 2026-05-11 at 5 07 53 PM

One bug I ran into was that we would ignore any new help pages if they had the same URL as the current page, so I fixed that in de7d3b4

@jennybc
Copy link
Copy Markdown
Member

jennybc commented May 11, 2026

Sorry I went along with something you said without checking it myself and ended up misleading you.

If people want help for dplyr, they probably want this: help(package = "dplyr"). Which is the index of help topics for the dplyr package.

@jennybc
Copy link
Copy Markdown
Member

jennybc commented May 11, 2026

On the other hand, I noticed the default package help pages are mostly useless as it only includes some cover page without any further links to dig deeper.

Yes, there's no requirement that a package have such a help topic and many don't. Or have something so minimal as to be practically useless.

@bricestacey bricestacey force-pushed the 12773/packages-help-link branch from de7d3b4 to 1d5a46a Compare May 12, 2026 00:23
bricestacey added a commit that referenced this pull request May 12, 2026
I assume this was added as a performance enhancement, but it introduces
bugs with the Ark implementation of help.

The search help pages are all served from the same URL. So if a user
entered:

```
??base
??cowsay
```

The help pane would open to the search results for `base` but not
`cowsay`. The user can resolve this by manually navigating away from the
page and re-executing `??cowsay` as the `sourceUrls` would never
previously match between pages.

This bug came out of #13499 but we chose a different implementation
where this fix was no longer needed.
}

.packages-list-item:hover .packages-list-item-help {
opacity: 0.85;
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.

This reads a little light on my machine. Perhaps just make it fully opaque?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think we want fully opaque because we want a contrast in brightness and therefore emphasis, but you're right the existing opacity was a bit light. Here is at least a justification, but if you try it out I think you'll find it's fine.

Bumped idle opacity from 0.5 → 0.7. Why not fully opaque (softwarenerd's suggestion): WCAG 2.1 SC 1.4.11 requires only 3:1 contrast for non-text UI components. VS Code's default foreground/background contrast is comfortably above 7:1 across stock themes, so 0.7 stays well over the 3:1 floor while preserving the visual hierarchy that lets the package name remain the focal point of each row. Progressive reveal is preserved: idle 0.7 → row hover 0.85 → button hover 1.

>
<svg fill='currentColor' height='11' viewBox='0 0 16 16' width='11'>
<path d='M2 2.5A.5.5 0 012.5 2H5c1.1 0 2.1.4 2.9 1.1.7-.7 1.8-1.1 2.9-1.1h2.5a.5.5 0 01.5.5v10a.5.5 0 01-.5.5H11c-1 0-1.9.4-2.5 1.1-.6-.7-1.5-1.1-2.5-1.1H2.5a.5.5 0 01-.5-.5v-10zM7.5 4.1C6.9 3.4 6 3 5 3H3v9h3c.7 0 1.4.2 2 .5.6-.3 1.2-.5 2-.5h2V3h-2c-1 0-1.9.4-2.5 1.1z' />
</svg>
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.

Perhaps this should be a codicon? @paul-dicristina can help with generating it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I just used the codicon, which already exists, but resized it.

@bricestacey bricestacey requested a review from softwarenerd May 21, 2026 14:15
Adds a help button on each row in the Packages pane (rendered only for
attached packages) that opens the package's help topic in the Help pane
via IPositronHelpService.showHelpTopic. Also bumps row horizontal
padding to 12px and switches the row to border-box sizing so its
padding sits inside react-window's assigned width, eliminating the
horizontal scroll the row was producing.

See #12773
`??name` does a fuzzy search across every installed package; what
we actually want from the Packages-pane button is the package's
help index. `help(package = "name", help_type = "html")` is the
canonical entry point -- printing the result triggers ark's
browseURL hook, which surfaces the index in the help pane.

See #12773
Swap the inline SVG for the existing codicon-book glyph, and raise the
idle opacity from 0.5 to 0.7 so the help button meets WCAG 1.4.11's
3:1 non-text contrast minimum across stock themes.
@bricestacey bricestacey force-pushed the 12773/packages-help-link branch from 4d2f67a to 4215b6f Compare May 21, 2026 20:18
@bricestacey
Copy link
Copy Markdown
Contributor Author

Rebased this so it now includes the new PositronList

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.

LG.

@bricestacey bricestacey merged commit 4899a3e into main May 22, 2026
24 checks passed
@bricestacey bricestacey deleted the 12773/packages-help-link branch May 22, 2026 13:32
@github-actions github-actions Bot locked and limited conversation to collaborators May 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants