godbolt.nvim icon indicating copy to clipboard operation
godbolt.nvim copied to clipboard

[feature request] Autoscroll

Open mcauley-penney opened this issue 2 years ago • 2 comments

Thanks for this plugin and awesome work!

A feature that I'd love with this is autoscroll. For example, as you scroll through your source code, the split that displays the corresponding assembly scrolls with you.

Thanks for your time!

mcauley-penney avatar Nov 21 '21 01:11 mcauley-penney

I don't have a clear idea rn, I'll think about this after I implement the TODOs mentioned in the readme

p00f avatar Nov 21 '21 08:11 p00f

That’s actually a good idea for an extension. TSPlayground works like this, I wonder how they do but typically something similar would be a killer feature.

darzok0914 avatar Nov 21 '21 16:11 darzok0914

Shameless plug, but I have impemented a similar feature for my plugin: https://github.com/krady21/compiler-explorer.nvim. It is based on vim.api.nvim_win_set_cursor.

krady21 avatar Jan 25 '23 17:01 krady21

What do you do when one line of source code corresponds to more than a page of assembly?

p00f avatar Jan 25 '23 18:01 p00f

I always set the cursor to the first line from the corresponding assembly output. I also thought about setting the cursor to the line exactly in the middle of the assembly output, but ended up going with the first option.

krady21 avatar Jan 31 '23 20:01 krady21

@krady21 then if the user jumps to the assembly window to scroll (because it doesn't fit etc) and then jumps back to the source window, it will count as a CursorMoved and the assembly window will scroll back up again right?

This is a hard problem, I think this is why godbolt.org doesn't do it either

p00f avatar Feb 01 '23 08:02 p00f

I'm closing this as it seems impossible to solve due to the window-jumping issue mentioned in the previous comment - I tried out compiler-explorer.nvim which has the same issue

p00f avatar Feb 13 '23 13:02 p00f