Skip to content

R: Snippets should stand down when completing ?some_function #3108

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

Closed
jennybc opened this issue May 10, 2024 · 3 comments
Closed

R: Snippets should stand down when completing ?some_function #3108

jennybc opened this issue May 10, 2024 · 3 comments
Assignees
Labels
area: completions Issues related to Completions area: help Issues related to Help category. bug Something isn't working lang: r

Comments

@jennybc
Copy link
Member

jennybc commented May 10, 2024

It's hard to request help via ? for a function that is a snippet. You can't benefit from the completion without getting more than you bargained for.

At first I thought this was just an add-on to #2338, but then I realized that my chosen example (lapply()) isn't just getting unwanted parentheses (basically harmless, I suppose), but also getting a full function signature, which truly does break the ? call.

What's special about lapply()? It's one of our built-in snippets.

https://github.com/posit-dev/amalthea/blob/486dc8bfa516ea45eb4eaddb19b2128bf51f679d/crates/ark/resources/snippets/r.code-snippets#L113-L117

I wish I could type ?lap then mash enter to get ?lapply then mash enter again to see help.

Screen.Recording.2024-05-10.at.3.02.53.PM.mov
@jennybc jennybc added bug Something isn't working area: help Issues related to Help category. lang: r labels May 10, 2024
@petetronic petetronic added this to the Release Candidate milestone May 13, 2024
@lionel- lionel- added the area: completions Issues related to Completions label May 17, 2024
@jennybc jennybc self-assigned this Jan 21, 2025
@jennybc
Copy link
Member Author

jennybc commented Apr 17, 2025

If we abolish built-in R snippets (a move I describe in #7234 and posit-dev/ark#779), this problem would go away.

A user's custom R snippets could still appear in this context, but that would come up much less often. This is also only really a problem with snippets where the prefix is exactly the name of a function.

jennybc added a commit that referenced this issue Apr 29, 2025
For posit-dev/ark#782
Addresses #7234
Addresses #3108

### Release Notes

#### New Features

- R snippets are now handled in the conventional way for VS Code, i.e.
via optional `.code-snippets` files at the user or workspace level or an
R-specific `r.json` file. Newly configured snippet files contain
examples for R and Python. The only R snippets that remain built-in are
those relating to reserved words (#7234).

#### Bug Fixes

- It is now possible to get completions via `?` for functions, e.g., in
the `apply()` family or for `switch()` (#3108).

### QA Notes

<!--
  Add additional information for QA on how to validate the change,
  paying special attention to the level of risk, adjacent areas that
  could be affected by the change, and any important contextual
  information not present in the linked issues.
-->
@jennybc
Copy link
Member Author

jennybc commented Apr 29, 2025

QA Notes pulled from above:

I wish I could type ?lap then mash enter to get ?lapply then mash enter again to see help.

@testlabauto
Copy link
Contributor

Verified Fixed

Positron Version(s) : 2025.06.0-14
OS Version          : OSX

Test scenario(s)

Works great with "QA notes pulled from above"

Link(s) to TestRail test cases run or created:

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: completions Issues related to Completions area: help Issues related to Help category. bug Something isn't working lang: r
Projects
None yet
Development

No branches or pull requests

4 participants