@@ -166,17 +166,21 @@ def run(self, edit):
166
166
self .view .window ().run_command ('xdebug_execute' , {'command' : 'run' })
167
167
168
168
169
- class XdebugRunToLineCommand (sublime_plugin .TextCommand ):
169
+ class XdebugRunToLineCommand (sublime_plugin .WindowCommand ):
170
170
"""
171
171
Run script to current selected line in view, ignoring all other breakpoints.
172
172
"""
173
- def run (self , edit ):
173
+ def run (self ):
174
+ view = sublime .active_window ().active_view ()
175
+ # Unable to run to line when no view available
176
+ if view is None :
177
+ return
174
178
# Determine filename for current view and check if is a valid filename
175
- filename = self . view .file_name ()
179
+ filename = view .file_name ()
176
180
if not filename or not os .path .isfile (filename ):
177
181
return
178
182
# Get first line from selected rows and make sure it is not empty
179
- rows = V .region_to_rows (self . view . sel (), filter_empty = True )
183
+ rows = V .region_to_rows (filter_empty = True )
180
184
if rows is None or len (rows ) == 0 :
181
185
return
182
186
lineno = rows [0 ]
@@ -188,8 +192,8 @@ def run(self, edit):
188
192
if not breakpoint_exists :
189
193
S .BREAKPOINT_RUN = { 'filename' : filename , 'lineno' : lineno }
190
194
# Set breakpoint and run script
191
- self . view .run_command ('xdebug_breakpoint' , {'rows' : [lineno ], 'enabled' : True , 'filename' : filename })
192
- self .view . window () .run_command ('xdebug_execute' , {'command' : 'run' })
195
+ view .run_command ('xdebug_breakpoint' , {'rows' : [lineno ], 'enabled' : True , 'filename' : filename })
196
+ self .window .run_command ('xdebug_execute' , {'command' : 'run' })
193
197
194
198
def is_enabled (self ):
195
199
return S .BREAKPOINT_ROW is not None and session .is_connected ()
@@ -231,6 +235,20 @@ def connected(self):
231
235
# Connection initialization
232
236
init = S .SESSION .read ()
233
237
238
+ # More detailed internal information on properties
239
+ S .SESSION .send (dbgp .FEATURE_SET , n = 'show_hidden' , v = 1 )
240
+ response = S .SESSION .read ()
241
+
242
+ # Set max depth limit
243
+ max_depth = S .get_project_value ('max_depth' ) or S .get_package_value ('max_depth' ) or S .MAX_DEPTH
244
+ S .SESSION .send (dbgp .FEATURE_SET , n = dbgp .FEATURE_NAME_MAXDEPTH , v = max_depth )
245
+ response = S .SESSION .read ()
246
+
247
+ # Set max children limit
248
+ max_children = S .get_project_value ('max_children' ) or S .get_package_value ('max_children' ) or S .MAX_CHILDREN
249
+ S .SESSION .send (dbgp .FEATURE_SET , n = dbgp .FEATURE_NAME_MAXCHILDREN , v = max_children )
250
+ response = S .SESSION .read ()
251
+
234
252
# Set breakpoints for files
235
253
for filename , breakpoint_data in S .BREAKPOINT .items ():
236
254
if breakpoint_data :
@@ -389,6 +407,9 @@ def run(self, command=None):
389
407
stack = session .get_stack_values ()
390
408
V .show_content (V .DATA_STACK , stack )
391
409
410
+ # Watch expressions
411
+ V .show_content (V .DATA_WATCH )
412
+
392
413
# Reload session when session stopped, by reaching end of file or interruption
393
414
if response .get (dbgp .ATTRIBUTE_STATUS ) == dbgp .STATUS_STOPPING or response .get (dbgp .ATTRIBUTE_STATUS ) == dbgp .STATUS_STOPPED :
394
415
self .window .run_command ('xdebug_session_stop' )
@@ -549,6 +570,50 @@ def is_visible(self):
549
570
return session .is_connected ()
550
571
551
572
573
+ class XdebugWatchCommand (sublime_plugin .WindowCommand ):
574
+ """
575
+ Add/Remove watch condition.
576
+ """
577
+ watch_index = None
578
+ def run (self , clear = False ):
579
+ if clear :
580
+ S .WATCH .clear ()
581
+ # Update watch view
582
+ try :
583
+ if sublime .active_window ().get_layout () == S .LAYOUT_DEBUG :
584
+ V .show_content (V .DATA_WATCH )
585
+ except :
586
+ pass
587
+ else :
588
+ # Show user input for setting watch expression
589
+ self .window .show_input_panel ('Watch expression' , '' , self .on_done , self .on_change , self .on_cancel )
590
+
591
+ def on_done (self , expression ):
592
+ if not expression :
593
+ return
594
+ # Add/update watch expression to session
595
+ watch = {'expression' : expression , 'enabled' : True , 'value' : None , 'type' : None }
596
+ if self .watch_index and isinstance (self .watch_index , int ):
597
+ try :
598
+ S .WATCH [self .watch_index ]['expression' ] = expression
599
+ except :
600
+ S .WATCH .insert (self .watch_index , watch )
601
+ else :
602
+ S .WATCH .append (watch )
603
+ # Update watch view
604
+ try :
605
+ if sublime .active_window ().get_layout () == S .LAYOUT_DEBUG :
606
+ V .show_content (V .DATA_WATCH )
607
+ except :
608
+ pass
609
+
610
+ def on_change (self , line ):
611
+ pass
612
+
613
+ def on_cancel (self ):
614
+ pass
615
+
616
+
552
617
class XdebugViewUpdateCommand (sublime_plugin .TextCommand ):
553
618
"""
554
619
Update content of sublime.Edit object in view, instead of using begin_edit/end_edit.
@@ -583,6 +648,7 @@ def run(self, layout='default', keymap=False):
583
648
if not layout == 'debug' :
584
649
return
585
650
# Reset data in debugging related windows
651
+ V .show_content (V .DATA_WATCH )
586
652
V .show_content (V .DATA_CONTEXT )
587
653
V .show_content (V .DATA_BREAKPOINT )
588
654
V .show_content (V .DATA_STACK )
0 commit comments