helix-editor / helix

A post-modern modal text editor.
https://helix-editor.com
Mozilla Public License 2.0
33.68k stars 2.5k forks source link

Debugging overhaul and redesign #5950

Open filipdutescu opened 1 year ago

filipdutescu commented 1 year ago

Description

The current debugging experience is less than ideal. While challenges are expected with TUI editors, the current experience is, to put it bluntly, raw. It is hard to launch or stop sessions, view variables, see which line the session is paused at etc. You also have no way to drill down into variable values (or if you have, it is so hidden I have yet to find it) or edit their values during a debugging session.

There is much more that should be done to ensure a smooth experience, including:

  1. defaults for binary targets (ie configuration type - Debug/Release, binary location - target/debug/myexe) which should be overridable in language.toml as well
  2. attach should show a searchable list of processes the user could choose from (search should include the option for process ID)
  3. 5927

Proposal

To address some of those pain points, I propose the following overhaul and redesign:

Related issues

UI/UX mockups

New UI for debugging: image

Help popup (using the current one as example): image

Expanding a variable's value (same prompt and cursor highlighting should be used for watches as well): image

Quick watch popup: image

archseer commented 1 year ago

For the variable views (the top pane called Locals -- it's technically variables), the idea was to repurpose the tree component from https://github.com/helix-editor/helix/pull/2377 / https://github.com/helix-editor/helix/pull/5768

filipdutescu commented 1 year ago

For the variable views (the top pane called Locals -- it's technically variables), the idea was to repurpose the tree component from https://github.com/helix-editor/helix/pull/2377 / https://github.com/helix-editor/helix/pull/5768

Yes, I plan on using the exact same mechanism as proposed by you. That part (local pane) and the quick watch one would be dependent on either of the two linked PRs.

filipdutescu commented 1 year ago

@CptPotato proposed a new design for the debug panel,which I like quite a bit. This is what I propose, moving forward: image

filipdutescu commented 1 year ago

Update on the current debug line (#5952). Latest developments lead me to this current implementation, which is a good MVP in my opinion. Further work can be done to improve the ability to customise components such as selection and cursor highlights, but they'll be out of scope for the current PR.

image

Dracula theme example: image

Onedark example: image

Ayu light example: image

filipdutescu commented 1 year ago

Update on the default theme. After talking some more with @archseer, we landed on this colour for the debug highlight, which I find beautiful:

image

filipdutescu commented 1 year ago

Latest update: #5952 was merged, hope it is a pleasant addition and a nice start to the overhaul! Thanks a lot to @pascalkuthe and @archseer for the help with the issue!

teburd commented 1 year ago

Would a disasm split or register view be something to consider? Debugging low level code these features in gdb are incredibly helpful

andreciobezerra commented 8 months ago

I hope this proposal is going on, the helix is fantastic, but the debug is really experimental.

filipdutescu commented 8 months ago

I have had some personal problems keeping me from dedicating sufficient time to tuis initiative. But all should start to clear up during summer, when I plan to get up to date with any progress made and pick it back up. Not sure what progress was made in the meantime though.

gyreas commented 8 months ago

Adding mouse actions like resizing the left pane would be nice, making the side pane windows collapsible would be another awesome addition too. By the way, who's had any luck using the debugger?

flo8 commented 5 months ago

This feature would be amazing! @filipdutescu would it be possible to have also console output to be displayed? This can be also useful to debug console applications that require user input. I actually thought about making a TUI specifically for Delve in Go as an addition to my Helix workflow. Your idea would even better as it would directly integrated into Helix.

Rot127 commented 5 months ago

To throw another "good to have" feature on the heap, it would be great if the interface supports data viewers of different languages.

E.g. having C + Rust is pretty common. And there are quite some bugs which occur during the interaction of the two. If the debugger switches from a Rust file to a C file, it should be able to seamlessly show the C types.

I just can't find an IDE which does this without problems (RustRover doesn't show C types and in VSCode, Rust debugging is broken with complicated building scenarios).

taylorpool commented 1 month ago

Curious what the progress has been here. I love Helix and debugging!