Fix local adapter specs

Somehow we lost the ability to define adapters in the local
.vimspector.json, I think when GetConfigurations was added.

Put that feature back.
This commit is contained in:
Ben Jackson 2020-11-30 10:19:02 +00:00
commit 8e2d352eb8
3 changed files with 18 additions and 5 deletions

View file

@ -296,8 +296,8 @@ function! vimspector#GetConfigurations() abort
return return
endif endif
let configurations = py3eval( let configurations = py3eval(
\ 'list( _vimspector_session.GetConfigurations()[ 1 ].keys() )' \ 'list( _vimspector_session.GetConfigurations( {} )[ 1 ].keys() )'
\ . ' if _vimspector_session else []' ) \ . ' if _vimspector_session else []' )
return configurations return configurations
endfunction endfunction

View file

@ -79,7 +79,7 @@ class DebugSession( object ):
self._server_capabilities = {} self._server_capabilities = {}
self.ClearTemporaryBreakpoints() self.ClearTemporaryBreakpoints()
def GetConfigurations( self ): def GetConfigurations( self, adapters ):
current_file = utils.GetBufferFilepath( vim.current.buffer ) current_file = utils.GetBufferFilepath( vim.current.buffer )
filetypes = utils.GetBufferFiletypes( vim.current.buffer ) filetypes = utils.GetBufferFiletypes( vim.current.buffer )
configurations = {} configurations = {}
@ -93,7 +93,8 @@ class DebugSession( object ):
with open( launch_config_file, 'r' ) as f: with open( launch_config_file, 'r' ) as f:
database = json.loads( minify( f.read() ) ) database = json.loads( minify( f.read() ) )
configurations.update( database.get( 'configurations' or {} ) ) configurations.update( database.get( 'configurations' ) or {} )
adapters.update( database.get( 'adapters' ) or {} )
return launch_config_file, configurations return launch_config_file, configurations
@ -109,8 +110,8 @@ class DebugSession( object ):
self._adapter = None self._adapter = None
current_file = utils.GetBufferFilepath( vim.current.buffer ) current_file = utils.GetBufferFilepath( vim.current.buffer )
launch_config_file, configurations = self.GetConfigurations()
adapters = {} adapters = {}
launch_config_file, configurations = self.GetConfigurations( adapters )
if not configurations: if not configurations:
utils.UserMessage( 'Unable to find any debug configurations. ' utils.UserMessage( 'Unable to find any debug configurations. '

View file

@ -1,5 +1,17 @@
{ {
"$schema": "https://puremourning.github.io/vimspector/schema/vimspector.schema.json",
"adapters": {
"test_custom": {
"command": "This is a test"
}
},
"configurations": { "configurations": {
"Use custom gadget": {
"adapter": "test_custom",
"configuration": {
"request": "launch"
}
},
// This is a comment. // This is a comment.
"run legacy vscode-python": { "run legacy vscode-python": {
"adapter": "vscode-python", /* coment goes here too */ "adapter": "vscode-python", /* coment goes here too */