calva icon indicating copy to clipboard operation
calva copied to clipboard

When jacking-in Sort the REPLs from most recently used to least recently used.

Open AbhinavOmprakash opened this issue 2 years ago β€’ 6 comments

I faced this scenario when I was working in a monorepo with multiple REPLs. When I jack-in and calva asks which REPL to connect to, I see a list like this

a/repl 
b/repl
c/repl
d/repl
e/repl

And I may only ever use b/repl and e/repl, having both at the top makes jacking-in more convenient.

An alternative that can be thought of is ordering by frequency of usage instead of recency. So if someone is primarily a backend dev and occasionally switch to front end, they will still see the backend REPL on top. But there are downsides as well- If the person switches from one project (inside a monorepo) to another and still sees their previous project on top then it might not be ideal.

I personally think that ordering by recency makes more sense and might be a tad easier to implement. If the implementation for this is easy, then I don't mind contributing (with some help).

AbhinavOmprakash avatar Aug 22 '23 03:08 AbhinavOmprakash

A contribution would be great! @PEZ is more familiar with that than I am and may be able to lend a hand, but if not, I'll see if I can make some time soon.

bpringe avatar Aug 22 '23 15:08 bpringe

Cool! I think it makes sense with recency. It's a pretty common Ux pattern, used quite a lot by VS Code, in file selectors, etcetera.

The current sort happens here.

https://github.com/BetterThanTomorrow/calva/blob/4374a8a83a6e745d155e6d4e4bbf1e385c2784ea/src/project-root.ts#L223

I guess the first step is to figure out what the grouping is about and try understand how to add the recency sort order without disrupting current workflow habits too much. Worst case we will need it to be a setting, but at a quick glance I think/hope we won't need that.

The timestamps can probably be saved in the workspace state (an object on the extension context).

Would be lovely to count you in as a code contributor to Calva, @AbhinavOmprakash! We in the Calva team will be eager to assist.

PEZ avatar Aug 22 '23 20:08 PEZ

Alright, I'll take a look. I'll need time, I need to familiarize myself with the vscode API as well.

AbhinavOmprakash avatar Aug 23 '23 04:08 AbhinavOmprakash

@AbhinavOmprakash I thought you were a Neovim user. πŸ€” πŸ˜ƒ

bpringe avatar Aug 24 '23 02:08 bpringe

@bpringe I am, I just use calva to jack-in πŸ˜… (and for things like find references if nvim's lsp is messed up)

AbhinavOmprakash avatar Aug 24 '23 04:08 AbhinavOmprakash

Just checking. Is it the project root directories we are talking about? I realize I don't understand what β€œREPLs” refers to here. πŸ˜„

PEZ avatar Dec 17 '23 14:12 PEZ