gwomacks / php-debug

Atom Text Editor package for PHP debugging
MIT License
119 stars 31 forks source link

Add clear watchpoints and clear-breakpoints buttons and other enhancements #299

Open jatubio opened 6 years ago

jatubio commented 6 years ago

On the old 0.2.4 version, I made some custom 'hacks', but with the new version I don't know where to touch to add them again.

And I think that they can be very useful for another users.

I have added two buttons: 'Clear Watchpoints' and 'Clear Breakpoints'. Because after some debug sessions, I get a lot of older Watchpoints and Breakpoints setups.

    when 'clear-watchpoints'
      @GlobalContext.setWatchpoints([])
    when 'clear-breakpoints'
      @GlobalContext.setBreakpoints([])

image

jatubio commented 6 years ago

Also, I have changed the code so that when I click on stack trace points, when it's changed the active tab to the corresponding file, the cursor is also placed on the line of the current execution:

php-debug-cofee:

    atom.workspace.open(filepath,{searchAllPanes: true, activatePane:true}).then (editor) =>
    if @currentCodePointDecoration
      @currentCodePointDecoration.destroy?()
    line = point.getLine()
    range = [[line-1, 0], [line-1, 0]]
    marker = editor.markBufferRange(range, {invalidate: 'surround'})

    type = point.getType?() ? 'generic'
    @currentCodePointDecoration = editor.decorateMarker(marker, {type: 'line', class: 'debug-break-'+type})
    editor.scrollToBufferPosition([line-1,0])
    editor.setCursorScreenPosition([line-1,0])
jatubio commented 6 years ago

I also moved the stack at the end because in 'side' mode it was more comfortable to have it there.

It would be ideal to have an option to choose the order of the panels. php-debug-unified-view.coffee:

   @div class: 'tabs-wrapper', outlet:'tabsWrapper', =>
      @div class: 'tabs-view', =>
        @div outlet: 'contextView', class:'php-debug-tab'
        @div outlet: 'watchpointView', class:'php-debug-tab'
        @div outlet: 'breakpointView', class:'php-debug-tab'
        @div outlet: 'stackView', class:'php-debug-tab'

Thank you