Add basic VimspectorDebugInfo command
This commit is contained in:
parent
aacd62f09f
commit
d43904eb57
6 changed files with 71 additions and 5 deletions
|
|
@ -1270,6 +1270,37 @@ class DebugSession( object ):
|
|||
self._stackTraceView.LoadThreads( True )
|
||||
|
||||
|
||||
@IfConnected()
|
||||
@RequiresUI()
|
||||
def PrintDebugInfo( self ):
|
||||
def Line():
|
||||
return ( "--------------------------------------------------------------"
|
||||
"------------------" )
|
||||
|
||||
def Pretty( obj ):
|
||||
if obj is None:
|
||||
return [ "None" ]
|
||||
return [ Line() ] + json.dumps( obj, indent=2 ).splitlines() + [ Line() ]
|
||||
|
||||
|
||||
debugInfo = [
|
||||
"Vimspector Debug Info",
|
||||
Line(),
|
||||
f"ConnectionType: { self._connection_type }",
|
||||
"Adapter: " ] + Pretty( self._adapter ) + [
|
||||
"Configuration: " ] + Pretty( self._configuration ) + [
|
||||
f"API Prefix: { self._api_prefix }",
|
||||
f"Launch/Init: { self._launch_complete } / { self._init_complete }",
|
||||
f"Workspace Root: { self._workspace_root }",
|
||||
"Launch Config: " ] + Pretty( self._launch_config ) + [
|
||||
"Server Capabilities: " ] + Pretty( self._server_capabilities ) + [
|
||||
]
|
||||
|
||||
self._outputView.ClearCategory( 'DebugInfo' )
|
||||
self._outputView.Print( "DebugInfo", debugInfo )
|
||||
self.ShowOutput( "DebugInfo" )
|
||||
|
||||
|
||||
def OnEvent_loadedSource( self, msg ):
|
||||
pass
|
||||
|
||||
|
|
|
|||
|
|
@ -64,8 +64,11 @@ class OutputView( object ):
|
|||
self._api_prefix = api_prefix
|
||||
VIEWS.add( self )
|
||||
|
||||
def Print( self, categroy, text ):
|
||||
self._Print( 'server', text.splitlines() )
|
||||
def Print( self, category, text: typing.Union[ str, list ] ):
|
||||
if not isinstance( text, list ):
|
||||
text = text.splitlines()
|
||||
|
||||
self._Print( category, text )
|
||||
|
||||
def OnOutput( self, event ):
|
||||
category = CategoryToBuffer( event.get( 'category' ) or 'output' )
|
||||
|
|
@ -104,13 +107,26 @@ class OutputView( object ):
|
|||
|
||||
def Clear( self ):
|
||||
for category, tab_buffer in self._buffers.items():
|
||||
if tab_buffer.is_job:
|
||||
utils.CleanUpCommand( category, self._api_prefix )
|
||||
utils.CleanUpHiddenBuffer( tab_buffer.buf )
|
||||
self._CleanUpBuffer( category, tab_buffer )
|
||||
|
||||
# FIXME: nunmenu the WinBar ?
|
||||
self._buffers = {}
|
||||
|
||||
|
||||
def ClearCategory( self, category: str ):
|
||||
if category not in self._buffers:
|
||||
return
|
||||
|
||||
self._CleanUpBuffer( category, self._buffers[ category ] )
|
||||
|
||||
|
||||
def _CleanUpBuffer( self, category: str, tab_buffer: TabBuffer ):
|
||||
if tab_buffer.is_job:
|
||||
utils.CleanUpCommand( category, self._api_prefix )
|
||||
|
||||
utils.CleanUpHiddenBuffer( tab_buffer.buf )
|
||||
|
||||
|
||||
def WindowIsValid( self ):
|
||||
return self._window.valid
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue