Add basic VimspectorDebugInfo command
This commit is contained in:
parent
aacd62f09f
commit
d43904eb57
6 changed files with 71 additions and 5 deletions
6
.github/ISSUE_TEMPLATE/bug_report.md
vendored
6
.github/ISSUE_TEMPLATE/bug_report.md
vendored
|
|
@ -57,6 +57,12 @@ discussing on Gitter rather than raising an issue.
|
||||||
* Version of Vimspector: (e.g. output of `git rev-parse HEAD` if cloned or the
|
* Version of Vimspector: (e.g. output of `git rev-parse HEAD` if cloned or the
|
||||||
name of the tarball used to install otherwise)
|
name of the tarball used to install otherwise)
|
||||||
|
|
||||||
|
* Output of `:VimspectorDebugInfo`
|
||||||
|
|
||||||
|
```
|
||||||
|
paste here
|
||||||
|
```
|
||||||
|
|
||||||
* Output of `vim --version` or `nvim --version`
|
* Output of `vim --version` or `nvim --version`
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -1070,6 +1070,8 @@ information when something goes wrong that's not a Vim traceback.
|
||||||
If you just want to see the Vimspector log file, use `:VimspectorToggleLog`,
|
If you just want to see the Vimspector log file, use `:VimspectorToggleLog`,
|
||||||
which will tail it in a little window (doesn't work on Windows).
|
which will tail it in a little window (doesn't work on Windows).
|
||||||
|
|
||||||
|
You can see some debugging info with `:VimspectorDebugInfo`
|
||||||
|
|
||||||
## Closing debugger
|
## Closing debugger
|
||||||
|
|
||||||
To close the debugger, use:
|
To close the debugger, use:
|
||||||
|
|
|
||||||
|
|
@ -557,6 +557,14 @@ function! vimspector#ShowEvalBalloon( is_visual ) abort
|
||||||
\ . '", 0 )' )
|
\ . '", 0 )' )
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! vimspector#PrintDebugInfo() abort
|
||||||
|
if !s:Enabled()
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
py3 _vimspector_session.PrintDebugInfo()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
" Boilerplate {{{
|
" Boilerplate {{{
|
||||||
let &cpoptions=s:save_cpo
|
let &cpoptions=s:save_cpo
|
||||||
|
|
|
||||||
|
|
@ -115,6 +115,9 @@ command! -bar -nargs=? -complete=custom,vimspector#CompleteOutput
|
||||||
command! -bar
|
command! -bar
|
||||||
\ VimspectorToggleLog
|
\ VimspectorToggleLog
|
||||||
\ call vimspector#ToggleLog()
|
\ call vimspector#ToggleLog()
|
||||||
|
command! -bar
|
||||||
|
\ VimspectorDebugInfo
|
||||||
|
\ call vimspector#PrintDebugInfo()
|
||||||
command! -nargs=1 -complete=custom,vimspector#CompleteExpr
|
command! -nargs=1 -complete=custom,vimspector#CompleteExpr
|
||||||
\ VimspectorEval
|
\ VimspectorEval
|
||||||
\ call vimspector#Evaluate( <f-args> )
|
\ call vimspector#Evaluate( <f-args> )
|
||||||
|
|
|
||||||
|
|
@ -1270,6 +1270,37 @@ class DebugSession( object ):
|
||||||
self._stackTraceView.LoadThreads( True )
|
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 ):
|
def OnEvent_loadedSource( self, msg ):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,8 +64,11 @@ class OutputView( object ):
|
||||||
self._api_prefix = api_prefix
|
self._api_prefix = api_prefix
|
||||||
VIEWS.add( self )
|
VIEWS.add( self )
|
||||||
|
|
||||||
def Print( self, categroy, text ):
|
def Print( self, category, text: typing.Union[ str, list ] ):
|
||||||
self._Print( 'server', text.splitlines() )
|
if not isinstance( text, list ):
|
||||||
|
text = text.splitlines()
|
||||||
|
|
||||||
|
self._Print( category, text )
|
||||||
|
|
||||||
def OnOutput( self, event ):
|
def OnOutput( self, event ):
|
||||||
category = CategoryToBuffer( event.get( 'category' ) or 'output' )
|
category = CategoryToBuffer( event.get( 'category' ) or 'output' )
|
||||||
|
|
@ -104,13 +107,26 @@ class OutputView( object ):
|
||||||
|
|
||||||
def Clear( self ):
|
def Clear( self ):
|
||||||
for category, tab_buffer in self._buffers.items():
|
for category, tab_buffer in self._buffers.items():
|
||||||
if tab_buffer.is_job:
|
self._CleanUpBuffer( category, tab_buffer )
|
||||||
utils.CleanUpCommand( category, self._api_prefix )
|
|
||||||
utils.CleanUpHiddenBuffer( tab_buffer.buf )
|
|
||||||
|
|
||||||
# FIXME: nunmenu the WinBar ?
|
# FIXME: nunmenu the WinBar ?
|
||||||
self._buffers = {}
|
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 ):
|
def WindowIsValid( self ):
|
||||||
return self._window.valid
|
return self._window.valid
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue