BetterThanTomorrow / calva

Clojure & ClojureScript Interactive Programming for VS Code
https://marketplace.visualstudio.com/items?itemName=betterthantomorrow.calva
Other
1.58k stars 212 forks source link

Info Panel #1116

Open ZaymonFC opened 3 years ago

ZaymonFC commented 3 years ago

Based on the discussion here: https://github.com/BetterThanTomorrow/calva/discussions/1071

The F# VsCode tooling (https://ionide.io/index.html) has this concept called an info panel. I haven't seen it anywhere else and dearly miss it (even when using other IDE's for F#).

I find it exceedingly useful in development and I feel like it could really pair well with Clojure's REPL driven development (especially as a productivity booster for beginners).

The basic idea is have the option to spawn a panel that shows the documentation for any function under the editor caret.

The functionality it offers is:

Screenshots: image

stuartstein777 commented 3 years ago

I miss this from Cursive. It displays the clojuredocs in a hover window that you can pin to a tool window.

clojuredocs

Would be a nice addition to Calva to have something like this / the OPs F# info panel.

bpringe commented 3 years ago

Would be a nice addition to Cursive to have something like this

Did you mean "addition to Calva?"

There's an issue here for adding clojuredoc info to the hover: https://github.com/BetterThanTomorrow/calva/issues/689

stuartstein777 commented 3 years ago

Yes, sorry Calva. Too many words starting with C!

ZaymonFC commented 3 years ago

@bpringe This is the issue for #1209. I have some initial thoughts around implementation but still very early in prototyping. Would be good to get some opinions.

Currently the F# implementation in Ionide uses a webview. I know this has a certain runtime cost, but a cost that's only paid if you open it.

My aspirational features are:

To do this, and create a nice base that people could further extend I think it's worth experimenting with getting either react or reagent running in the panel and defining a way for the embedded application to communicate with the extension.

Alternatively if that proves to be too 'heavy' something like svelte might be the right fit for templating / adding an amount of interactivity.

bpringe commented 3 years ago

Ah, thanks for reminding me about this issue. What would react/reagent be needed for? Do you intend to have the info panel be interactive? I think if it just needs to have its content changed upon certain editor actions, etc., then the webview API should suffice, but I haven't messed with it much, so I may be wrong.

Hamido-san commented 3 years ago

I hope all this talk of the webview API doesn't mean the Calva implementation would require an active internet connection to show the clojuredocs. In Cursive for example, when a Clojure project is opened a background task tries to fetch the latest changes from clojuredocs, but being offline doesn't impede using the "outdated" content.

ZaymonFC commented 3 years ago

@Hamido-san There are .edn exports of clojuredocs available (like in the linked orchard implementation) so having an active internet connection shouldn't be required. We could probably ship it with the extension and periodically update it? Not sure how valuable having the bleeding edge of clojuredocs example would even be 😅.

@bpringe To build the pinning functionality (which I think would add a lot of value) requires interactivity, how that's achieved I don't really mind.

Hamido-san commented 3 years ago

@ZaymonFC @bpringe I don't mean to be a nay-sayer, but there seems to be no need to create a new "pinning functionality". Instead, the info "panel" can be a normal document tab in a new group, just like:

bpringe commented 3 years ago

@ZaymonFC I see. I think the pinning feature could use some hammock time. Maybe a simplified/MVP version of this feature would be good to release first. Maybe it wouldn't include pinning at first - just a thought. I'm not against adding pinning at release, though.

In regards to adding clojuredocs info, this issue is related: https://github.com/BetterThanTomorrow/calva/issues/689