livebook icon indicating copy to clipboard operation
livebook copied to clipboard

Provide go to definition of modules and functions defined in the notebook

Open josevalim opened this issue 2 years ago • 6 comments

When we show the docs, we can have a "go to definition" button. We can also support ctrl+click, as in Visual Studio.

josevalim avatar Nov 23 '22 22:11 josevalim

Hi @josevalim can I pick up this issue?

hameedhub avatar Sep 14 '23 11:09 hameedhub

Yes, please!

josevalim avatar Sep 14 '23 11:09 josevalim

Hey! Are you still working on this, @hameedhub ? 🙂

I was curious and had a cursory look at this issue last night. From what I picked up, we already have systems in place for fetching modules/functions defined within a given notebook (as used by the autocompletion feature). That's great!

However, it seems that the information we require for go-to-definition wasn't available from the list of list(Runtime.completion_item())s the Intellisense feature uses. I believe we'd need both 1) the id of the cell that contains the given module/function (which is passed to data-p-cell-id in the HTML), as well as 2) the line number within that cell. With these two pieces of information the frontend could then jump to a given cell at the appropriate location.

What would the high-level idea here be for implementation? Am I on the right track in terms of what data we need in the liveview? Would you see this as something that re-uses the functionality in Livebook.Intellisense, or should this be something else entirely? I didn't yet read enough code to understand if we have easy ways for fetching the id or the row number of a cell at all, so that's a bit of a mystery as well.

juhalehtonen avatar Feb 15 '24 09:02 juhalehtonen

I believe @cristineguadelupe is looking into this as well. :)

josevalim avatar Feb 15 '24 09:02 josevalim

Ah, great 🙂 Thanks for the heads-up!

juhalehtonen avatar Feb 15 '24 10:02 juhalehtonen

I believe @cristineguadelupe is looking into this as well. :)

Yep! It's on my todo list

cristineguadelupe avatar Feb 16 '24 09:02 cristineguadelupe

Closed in #2730 and #2741.

jonatanklosko avatar Aug 16 '24 08:08 jonatanklosko