@@ -100,27 +100,7 @@ def _UpdateView( self, breakpoint_list, show=True ):
100100
101101 utils .SetSyntax ( '' , 'vimspector-breakpoints' , self ._buffer )
102102
103- if utils .UseWinBar ():
104- vim .command ( 'nnoremenu <silent> 1.1 WinBar.Delete '
105- ':call vimspector#DeleteBreakpointViewBreakpoint()<CR>' )
106- vim .command ( 'nnoremenu <silent> 1.2 WinBar.Toggle '
107- ':call vimspector#ToggleBreakpointViewBreakpoint()<CR>' )
108- vim .command ( 'nnoremenu <silent> 1.2 WinBar.*Toggle '
109- ':call'
110- ' vimspector#ToggleAllBreakpointsViewBreakpoint()<CR>' )
111- vim .command ( 'nnoremenu <silent> 1.3 WinBar.Jump\\ To '
112- ':call vimspector#JumpToBreakpointViewBreakpoint()<CR>' )
113- # TODO: Add tests for this function
114- vim .command ( 'nnoremenu <silent> 1.4 WinBar.+Line '
115- ':call vimspector#SetAdvancedLineBreakpoint()<CR>' )
116- vim .command ( 'nnoremenu <silent> 1.4 WinBar.+Function '
117- ':call vimspector#AddAdvancedFunctionBreakpoint()<CR>' )
118- vim .command ( 'nnoremenu <silent> 1.4 WinBar.Clear '
119- ':call vimspector#ClearBreakpoints()<CR>' )
120- vim .command ( 'nnoremenu <silent> 1.4 WinBar.Save '
121- ':call vimspector#WriteSessionFile()<CR>' )
122- vim .command ( 'nnoremenu <silent> 1.4 WinBar.Load '
123- ':call vimspector#ReadSessionFile()<CR>' )
103+ self ._RenderWinBar ()
124104
125105 # we want to maintain the height of the window
126106 self ._win .options [ "winfixheight" ] = True
@@ -141,6 +121,28 @@ def FormatEntry( el ):
141121 utils .SetBufferContents ( self ._buffer ,
142122 list ( map ( FormatEntry , breakpoint_list ) ) )
143123
124+
125+ def _RenderWinBar ( self ):
126+ if not utils .UseWinBar ():
127+ return
128+
129+ if not self ._HasWindow ():
130+ return
131+
132+ with utils .LetCurrentWindow ( self ._win ):
133+ utils .SetWinBar (
134+ ( 'Del' , 'vimspector#DeleteBreakpointViewBreakpoint()' ),
135+ ( 'On/Off' , 'vimspector#ToggleBreakpointViewBreakpoint()' ),
136+ ( 'Edit' , 'vimspector#EditBreakpointOptionsViewBreakpoint()' ),
137+ ( '+Line' , 'vimspector#SetAdvancedLineBreakpoint()' ),
138+ ( '+Func' , 'vimspector#AddAdvancedFunctionBreakpoint()' ),
139+ ( 'Clr All' , 'vimspector#ClearBreakpoints()' ),
140+ ( 'Clr Excp' , 'vimspector#ResetExceptionBreakpoints()' ),
141+ ( 'Save' , 'vimspector#WriteSessionFile()' ),
142+ ( 'Load' , 'vimspector#ReadSessionFile()' ),
143+ )
144+
145+
144146 def CloseBreakpoints ( self ):
145147 if not self ._HasWindow ():
146148 return
@@ -337,6 +339,22 @@ def JumpToBreakpointViewBreakpoint( self ):
337339
338340 _JumpToBreakpoint ( bp )
339341
342+ def EditBreakpointOptionsViewBreakpoint ( self ):
343+ vbp = self ._breakpoints_view .GetBreakpointForLine ()
344+ if not vbp :
345+ return
346+
347+ # Try to find the actual breakpoint
348+ bp , index = self ._FindLineBreakpoint ( vbp .get ( 'filename' ),
349+ vbp .get ( 'lnum' ) )
350+
351+ if not bp :
352+ return
353+
354+ bp [ 'options' ] = GetAdvancedBreakpointOptions ( bp [ 'options' ] )
355+ self .UpdateUI ()
356+
357+
340358 def JumpToNextBreakpoint ( self , reverse = False ):
341359 bps = self ._breakpoints_view ._breakpoint_list
342360 if not bps :
@@ -441,6 +459,12 @@ def ClearBreakpoints( self ):
441459 self .UpdateUI ()
442460
443461
462+ def ResetExceptionBreakpoints ( self ):
463+ # TODO: Should exceptoni breakpoints be per-session!?
464+ self ._exception_breakpoints = None
465+ self .UpdateUI ()
466+
467+
444468 def _FindLineBreakpoint ( self , file_name , line ):
445469 for bp , index in self ._AllBreakpointsOnLine ( file_name , line ):
446470 return bp , index
@@ -1224,3 +1248,26 @@ def _SignToLine( self, file_name, bp ):
12241248 bp [ 'line' ] = int ( signs [ 0 ][ 'signs' ][ 0 ][ 'lnum' ] )
12251249
12261250 return
1251+
1252+
1253+ _extended_breakpoint_properties = [
1254+ { 'prop' : 'condition' , 'msg' : 'Enter condition expression' },
1255+ { 'prop' : 'hitCondition' , 'msg' : 'Enter hit count expression' },
1256+ { 'prop' : 'logMessage' ,
1257+ 'msg' : 'Enter log expression (to make log point)' },
1258+ ]
1259+
1260+
1261+ def GetAdvancedBreakpointOptions ( existing_options = None ):
1262+ # TODO: Port the vimscript function to here, call it (initially) from
1263+ # vimscript, then also call it from EditBreakpointOptionsViewBreakpoint
1264+ options = existing_options if existing_options is not None else {}
1265+ for spec in _extended_breakpoint_properties :
1266+ response = utils .AskForInput ( spec [ 'msg' ] + ': ' ,
1267+ options .get ( spec [ 'prop' ] ) )
1268+ if response is None :
1269+ return None
1270+ elif response :
1271+ options [ spec [ 'prop' ] ] = response
1272+
1273+ return options
0 commit comments