Skip to content
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

Add a custom backend for Kernel.dbg/2 #191

Merged
merged 16 commits into from
Aug 30, 2022
Merged

Add a custom backend for Kernel.dbg/2 #191

merged 16 commits into from
Aug 30, 2022

Conversation

jonatanklosko
Copy link
Member

@jonatanklosko jonatanklosko commented Aug 25, 2022

Registers a custom backend for Kernel.dbg/2. For pipelines it renders an interactive editor, otherwise it renders the result with the Kino.Render protocol.

kino_dbg.webm

lib/kino/js/live.ex Outdated Show resolved Hide resolved
lib/kino/bridge.ex Outdated Show resolved Hide resolved
case ast do
{:|>, _meta, _args} ->
quote do
if pid = unquote(__MODULE__).lookup_dbg_handler(unquote(dbg_id)) do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick question: what happens if dbg was invoked from a separate process? Do we also want to show the "fancy" version?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually that's an interesting case, I would say there is no reason to differentiate that, however the relevant detail is that the started kino is tied to the process lifetime, so when debugging a process that crashes this is an issue.

@josevalim
Copy link
Contributor

Btw, ehe "Copy new pipeline" text should also be clickable :)

It would also be great if we could use keyboard navigation once a pipe is focused!

@josevalim
Copy link
Contributor

josevalim commented Aug 28, 2022

Finally, after playing with it for a little bit, I think we should do some final changes to the selector.

First, if there is an error and the error is fixed, we should automatically select the last row.

Second, take this example:

image

If I drag the fourth (last) item to the second position, then the new fourth item should remain selected. I.e. the selector should be a property of the row (like the 4th row) not of the pipe entry. (I would argue that perhaps any operation should always select the last line, but I think you will find that too strict? :D)

Co-authored-by: José Valim <[email protected]>
Co-authored-by: Hugo Baraúna <[email protected]>
@jonatanklosko
Copy link
Member Author

jonatanklosko commented Aug 29, 2022

@josevalim there are cases where tracking selection on row basis is also unintuitive. For example:

image

When we move filter above shuffle, it makes more sense to keep map selected to see what impact filter had, rather than to select shuffle.

I actually think that always selecting the last one is less arbitrary than that, so it's fine by me :)

@jonatanklosko
Copy link
Member Author

FTR I added tests and a demo to the PR description :)

@jonatanklosko jonatanklosko merged commit 2ef471d into main Aug 30, 2022
@jonatanklosko jonatanklosko deleted the jk-dbg branch August 30, 2022 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants