@@ -33,12 +33,18 @@ function! OmniSharp#actions#project#DebugProject(stopAtEntry, ...) abort
33
33
let project = getbufvar (a: bufnr , ' OmniSharp_host' ).project
34
34
" Make sure we're not running on a csx script
35
35
if project.ScriptProject is v: null
36
+ let targetProgramFilename = fnamemodify (project.MsBuildProject.TargetPath, ' :t' )
37
+ let folderWithAppConfigFiles = fnamemodify (project.MsBuildProject.TargetPath, ' :h:p' )
38
+ if has (' win32' )
39
+ let folderWithAppConfigFiles = substitute (folderWithAppConfigFiles, ' \' , ' /' , ' g' )
40
+ endif
36
41
call vimspector#LaunchWithConfigurations ({
37
42
\ ' launch' : {
38
43
\ ' adapter' : ' netcoredbg' ,
39
44
\ ' configuration' : {
40
- \ ' request' : ' launch' ,
41
- \ ' program' : project.MsBuildProject.TargetPath,
45
+ \ ' request' : ' launch' ,
46
+ \ ' cwd' : folderWithAppConfigFiles,
47
+ \ ' program' : targetProgramFilename,
42
48
\ ' args' : a: args ,
43
49
\ ' stopAtEntry' : a: stopAtEntry ? v: true : v: false
44
50
\ }
@@ -57,6 +63,11 @@ function! OmniSharp#actions#project#CreateDebugConfig(stopAtEntry, ...) abort
57
63
let bufnr = bufnr (' %' )
58
64
function ! CreateDebugConfigCb (bufnr , stopAtEntry, args ) abort
59
65
let host = getbufvar (a: bufnr , ' OmniSharp_host' )
66
+ let targetProgramFilename = fnamemodify (host.project.MsBuildProject.TargetPath, ' :t' )
67
+ let folderWithAppConfigFiles = fnamemodify (host.project.MsBuildProject.TargetPath, ' :h:p' )
68
+ if has (' win32' )
69
+ let folderWithAppConfigFiles = substitute (folderWithAppConfigFiles, ' \' , ' /' , ' g' )
70
+ endif
60
71
let contents = [
61
72
\' {',
62
73
\' " configurations" : {',
@@ -71,7 +82,8 @@ function! OmniSharp#actions#project#CreateDebugConfig(stopAtEntry, ...) abort
71
82
\' " adapter" : " netcoredbg" ,',
72
83
\' " configuration" : {',
73
84
\' " request" : " launch" ,',
74
- \' " program" : " '.host.project.MsBuildProject.TargetPath.'" ,',
85
+ \' " cwd" : " ' . folderWithAppConfigFiles . '" ,',
86
+ \' " program" : " ' . targetProgramFilename . '" ,',
75
87
\' " args" : ' . json_encode(a:args) . ' ,',
76
88
\' " stopAtEntry" : ' . (a:stopAtEntry ? ' true' : ' false'),
77
89
\' }',
0 commit comments