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

Breakpoints #7

Merged
merged 31 commits into from
Jul 30, 2024
Merged

Breakpoints #7

merged 31 commits into from
Jul 30, 2024

Conversation

Anthony-Eid
Copy link
Collaborator

@Anthony-Eid Anthony-Eid commented Jul 25, 2024

Release Notes:

Currently breakpoints are not updated when lines before a breakpoint are deleted or added. Breakpoints also don't persistent between separate reloads of zed. The goal of this PR is to tackle both these issues to get breakpoints that stay in the same position relative to the line of code they were placed on and get breakpoints to remain after closing zed.

Completed:

  • Get breakpoints to be anchored to the line of code they are connected too
  • Share breakpoints between Project & Editor via a pointer to a RWLock
  • Only share the pointer to the breakpoints from Editor to Project once
    position
  • Get breakpoint indicator to show on gutter when mouse is over it
  • Clicking on breakpoint indicator toggles a breakpoint

Next PR TODO:

  • Serialize breakpoint to be able to save them in Zed's database
  • Save breakpoints in zed's database
  • testing
  • documentation
  • Figure out how we want to handle a the case of a line deletion where the line directly correspond to a breakpoint

Discovered Bugs:

  • Can only spawn one debug session per id (Probably due to assign each dap client the same id) [Fixed]
  • Debugger should save current files before running. Otherwise breakpoint locations can be inconsistent or some of users code won't run. This should be explored in the future to decide if our current behavior is acceptable.
  • Breakpoints overlap with code action indicator
  • Toggle breakpoints through the command line don't affect breakpoints added by clicking on gutter and vice versa

Current Behavior:

Screen.Recording.2024-07-27.at.6.13.58.PM.mov

Anthony-Eid and others added 17 commits July 14, 2024 15:35
The main thing this commit does is fix race conditions between a
dap client's event handler and sending a launch/attach request.
Some adapters would only respond to a starting request after the
client handled an init event, which could never happen because
the client used to start it's handler after it sent a launch request.

This commit also ignores undefined errors instead of crashing. This
allows the client to work with adapters that send custom events.

Finially, I added some more descriptive error messages and change
client's starting request seq from 0 to 1 to be more in line with
the specs.
Adds the ability to ignore custom events. Also,
some more descriptive error handling and documentation.
Merging with the main zed branch removed a function that
the debugger panel relied on. I added the function back
and changed it to work with the updated internals of zed.
Warning: Project is not being sent breakpoints right now
Breakpoints are now stored in a BTreeMap<buffer_id, HashSet<Breakpoint>>
I did this becauase we need to constant check if a breakpoint exists in
a buffer whenever we toggle one.
Previously editor would send breakpoints to project whenever
a new breakpoint was deleted or added. Now editor shares a
shared pointer to a breakpoint datastructure. This behavior
is more efficient because it doesn't have to repeatly send
breakpoints everytime one is updated.

Still have to handle cases when a breakpoint is added/removed during
a debugging phase. I also have to figure out how to share the breakpoints
pointer only once per project and editor.
Instead of editor sharing with project each time a breakpoint is toggled. An
editor will clone project's breakpoints if a project is passed into the editors
new function
The end goal of this commit is to allow a user to set a breakpoint by
hovering over a line in the editor's gutter. Currently breakpoints
only show on line 6 when the mouse is on a gutter.
…oint

The breakpoints that are added through clicking on the gutter can't be affect by the toggle
breakpoint command. This is a bug
@Anthony-Eid Anthony-Eid marked this pull request as ready for review July 27, 2024 22:56
…ng files

The crash was happening because editor was trying to render all breakpoints even if they didn't
belong to the current buffer. Breakpoint don't persistent after closing a tab, will need to
change the breakpoint DS key from buffer_id to something more permament
@Anthony-Eid Anthony-Eid merged commit 26a5770 into RemcoSmitsDev:debugger Jul 30, 2024
0 of 4 checks passed
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.

2 participants