Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Positron's help panel is not used when F1 is invoked #580

Closed
andrewheiss opened this issue Oct 21, 2024 · 4 comments
Closed

Positron's help panel is not used when F1 is invoked #580

andrewheiss opened this issue Oct 21, 2024 · 4 comments

Comments

@andrewheiss
Copy link

andrewheiss commented Oct 21, 2024

Currently, in VS Code, pressing F1 inside a function name opens the documentation in a special "Quarto: Help" panel in the File Explorer:

Image

That's great when using VS Code because it doesn't have a dedicated help panel like RStudio does.

However, in the spirit of RStudio, Positron does have a dedicated help panel—when pressing F1 in a regular R script in Positron, the documentation opens there:

Image

When pressing F1 in a Quarto file in Positron, though, nothing happens in the Positron help panel. Instead, the documentation appears in the custom Quarto help panel:

Image

There's an issue at Positron tracking this: posit-dev/positron#4097 and it's part of a larger push for better Quarto improvements (posit-dev/positron#4858). I figured that F1 wasn't doing anything at all (I'd forgotten about Quarto's custom help panel), and others likely thought the same, but a recent comment posit-dev/positron#4097 (comment) discovered that F1 is actually working as expected in Positron—it's just invisible if the custom Quarto help panel is hidden.

So the underlying issue seems to be that Quarto's VS Code extension is hijacking F1 inside Positron

@juliasilge
Copy link
Collaborator

It turns out this is the quarto-assist webview the Quarto extension contributes; it can be pinned/unpinned with commands quarto.assist.pin and quarto.assist.unpin. There are three kinds of things that can get rendered in this webview:

const kAssistHelp = "Quarto: Help";
const kAssistEquation = "Quarto: Equation";
const kAssistImage = "Quarto: Image";

Once you get this webview going, it responds to where your cursor is and renders things for you, depending on whether it is an equation, a function etc. The Help does not seem to work for Python for me, and I have not found a pydoc server or anything like that.

One option would be to turn this webview off in Positron and hook up F1 to calling Positron's Help; it does seem like most use of it is for Help from the issues about it. Or I guess we can pipe through F1 to Positron's Help without messing with this at all, and they both would be available.

Real talk: I had never pulled up this webview until starting to look into this today.

@juliasilge
Copy link
Collaborator

The command in Positron is positron.help.showHelpAtCursor here:
https://github.com/posit-dev/positron/blob/465058d309f13331ba2f458f8e99e6d5eeaea541/src/vs/workbench/contrib/positronHelp/browser/positronHelpActions.ts#L32

The command goes to a help topic provider that is a languageFeaturesService which I guess is different from a languageFeaturesRegistry (what the statement range provider is); still we'll probably need something along the lines of posit-dev/positron#3107 in Positron to pipe it through.

@juliasilge
Copy link
Collaborator

juliasilge commented Nov 9, 2024

I got this wrapped up in #599 plus posit-dev/positron#5292. I'm going to close this now but just FYI @andrewheiss the fix in Positron hasn't been promoted to a public build yet and probably won't be until early next week. When that happens, you'll need a) the new Positron build and b) the dev Quarto extension version. You can get a development version of the Quarto extension by downloading the artifact built here, unzipping it, install the .vsix from the command palette (i.e. manually install the extension from a local file), and then restarting Positron.

Thanks again for the report! 🙌

@andrewheiss
Copy link
Author

woohoo! Thanks for the quick fix!

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

No branches or pull requests

2 participants