Skip to content

Commit

Permalink
Merge pull request puremourning#588 from puremourning/vimrc-config
Browse files Browse the repository at this point in the history
Allow truthy values for default and autoselect
  • Loading branch information
mergify[bot] authored May 1, 2022
2 parents 6f88a89 + 083ad91 commit 960f044
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 4 deletions.
4 changes: 2 additions & 2 deletions python3/vimspector/debug_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ def Start( self,
else:
# Find a single configuration with 'default' True and autoselect not False
defaults = { n: c for n, c in configurations.items()
if c.get( 'default', False ) is True
and c.get( 'autoselect', True ) is not False }
if c.get( 'default', False )
and c.get( 'autoselect', True ) }

if len( defaults ) == 1:
configuration_name = next( iter( defaults.keys() ) )
Expand Down
4 changes: 2 additions & 2 deletions support/test/multiple_filetypes/.vimspector.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"configuration": {
"request": "launch",
"protocol": "auto",
"stopOnEntry": true,
"stopOnEntry": false,
"console": "integratedTerminal",
"program": "${workspaceRoot}/test.js",
"cwd": "${workspaceRoot}"
Expand All @@ -26,7 +26,7 @@
"configuration": {
"request": "launch",
"program": "${workspaceRoot}/test.py",
"stopOnEntry": true,
"stopOnEntry": false,
"cwd": "${workspaceRoot}"
},
"breakpoints": {
Expand Down
2 changes: 2 additions & 0 deletions tests/get_configurations.test.vim
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ function! Test_PickConfiguration_FilteredFiletypes()
let fn = '../support/test/multiple_filetypes/test.js'
exe 'edit ' . fn
normal! G
call vimspector#SetLineBreakpoint( fn, 1 )
call vimspector#Launch()
call WaitForAssert( { ->
\ vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 1, 1 )
Expand All @@ -44,6 +45,7 @@ function! Test_PickConfiguration_FilteredFiletypes()
let fn = '../support/test/multiple_filetypes/test.py'
exe 'edit ' . fn
normal! G
call vimspector#SetLineBreakpoint( fn, 1 )
call vimspector#Launch()
call WaitForAssert( { ->
\ vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 1, 1 )
Expand Down
89 changes: 89 additions & 0 deletions tests/language_csharp.test.vim
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,101 @@ function! Test_CSharp_Simple_VimDict_Config()
\ 'adapter': 'test_adapter',
\ 'configuration': {
\ 'request': 'launch',
\ 'default': v:true,
\ 'program': '${workspaceRoot}/bin/Debug/netcoreapp5.0/csharp.dll',
\ 'args': [],
\ 'stopAtEntry': v:false
\ }
\ },
\ 'ignored_configuration': { 'adapter': 'does_not_exist' }
\ } )
call SkipUnsupported()
let fn='Program.cs'
lcd ../support/test/csharp
exe 'edit ' . fn

call vimspector#SetLineBreakpoint( fn, 31 )
call vimspector#LaunchWithSettings(
\ { 'configuration': 'test_configuration' } )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 31, 7 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( fn, 31 )
\ } )

call vimspector#StepOver()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 32, 12 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( fn, 32 )
\ } )

call vimspector#test#setup#Reset()

lcd -
%bwipeout!
endfunction

function! Test_CSharp_Simple_VimDict_Config_TruthyDefault()
call vimspector#test#setup#PushSetting( 'vimspector_adapters', {
\ 'test_adapter': {
\ 'extends': 'netcoredbg',
\ }
\ } )
call vimspector#test#setup#PushSetting( 'vimspector_configurations', {
\ 'test_configuration': {
\ 'adapter': 'test_adapter',
\ 'configuration': {
\ 'request': 'launch',
\ 'default': 1,
\ 'program': '${workspaceRoot}/bin/Debug/netcoreapp5.0/csharp.dll',
\ 'args': [],
\ 'stopAtEntry': v:false
\ }
\ },
\ 'ignored_configuration': { 'adapter': 'does_not_exist' }
\ } )
call SkipUnsupported()
let fn='Program.cs'
lcd ../support/test/csharp
exe 'edit ' . fn

call vimspector#SetLineBreakpoint( fn, 31 )
call vimspector#LaunchWithSettings(
\ { 'configuration': 'test_configuration' } )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 31, 7 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( fn, 31 )
\ } )

call vimspector#StepOver()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 32, 12 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( fn, 32 )
\ } )

call vimspector#test#setup#Reset()

lcd -
%bwipeout!
endfunction

function! Test_CSharp_Simple_VimDict_Config_Autoselect()
call vimspector#test#setup#PushSetting( 'vimspector_adapters', {
\ 'test_adapter': {
\ 'extends': 'netcoredbg',
\ }
\ } )
call vimspector#test#setup#PushSetting( 'vimspector_configurations', {
\ 'test_configuration': {
\ 'adapter': 'test_adapter',
\ 'configuration': {
\ 'request': 'launch',
\ 'program': '${workspaceRoot}/bin/Debug/netcoreapp5.0/csharp.dll',
\ 'args': [],
\ 'stopAtEntry': v:false
\ }
\ },
\ 'ignored_configuration': { 'adapter': 'does_not_exist', 'autoselect': 0 }
\ } )
call SkipUnsupported()
let fn='Program.cs'
lcd ../support/test/csharp
Expand Down

0 comments on commit 960f044

Please sign in to comment.