posit-dev / posit-dev/positron

R: Extended LSP requests for object at cursor

Open
#14,743 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: editor area: kernels enhancement
Dominant language
TypeScript
Stars
4.3k
Forks
184
Avg merge
1d 11h
Merged PRs (30d)
206

Description

Originally posted by @lionel- in #2974:

Relatedly, I've been thinking for a while about porting a feature I created in Emacs and used all the time as a data analyst. This feature has two parts:

  • Detect relevant object at cursor. For instance, foo$bar$q<>ux gives you foo$bar$qux, foo$bar<>$qux gives you foo$bar, and f<>oo$bar$qux gives you foo. This would be provided via an extended LSP request.

  • Provide various exploration commands for the object at cursor: print(), summary(), str(), lobstr::sxp(), etc. These exploration commands should be user-configurable (simple list of strings with some kind of symbol representing where the input goes). And View() could be one of the default actions.

The commands could each be an assist but I'd worry about cluttering the assist menu and making it harder to use as we add new kinds of assists in the future. So we could have a single assist for "Actions at point" that opens up a quickpick menu. It'd be great to implement frecency (thanks for the notion @DavisVaughan!) sorting of these commands.

This should also be its own command to make it quicker to use (no need to open the assist menu). Making it an assist is good for discoverability though. And there should also be a command to directly run an action. The command would take an action string as argument. This could be bound to Cmd+Click with View(%%) as action for instance.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by locating the existing LSP, assist, and command entry points; use the cursor examples to define the object request and action flow, then verify configurable actions, View(), direct invocation, discoverability, and frecency behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
r, typescript
Domain
data, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.