Skip to content

Commit 2b664e3

Browse files
author
Minh-Tam TRAN
committed
remove cwd since the program can pick its own content root path for configuration files, and it prevents referencing files by relative path when providing arguments
1 parent 9365732 commit 2b664e3

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

autoload/OmniSharp/actions/project.vim

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,14 @@ function! OmniSharp#actions#project#DebugProject(stopAtEntry, ...) abort
3333
let project = getbufvar(a:bufnr, 'OmniSharp_host').project
3434
" Make sure we're not running on a csx script
3535
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+
let programPath = project.MsBuildProject.TargetPath
37+
if has('win32') | let programPath = substitute(programPath, '\', '/', 'g') | endif
4138
call vimspector#LaunchWithConfigurations({
4239
\ 'launch': {
4340
\ 'adapter': 'netcoredbg',
4441
\ 'configuration': {
4542
\ 'request': 'launch',
46-
\ 'cwd': folderWithAppConfigFiles,
47-
\ 'program': targetProgramFilename,
43+
\ 'program': programPath,
4844
\ 'args': a:args,
4945
\ 'stopAtEntry': a:stopAtEntry ? v:true : v:false
5046
\ }
@@ -63,11 +59,8 @@ function! OmniSharp#actions#project#CreateDebugConfig(stopAtEntry, ...) abort
6359
let bufnr = bufnr('%')
6460
function! CreateDebugConfigCb(bufnr, stopAtEntry, args) abort
6561
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
62+
let programPath = host.project.MsBuildProject.TargetPath
63+
if has('win32') | let programPath = substitute(programPath, '\', '/', 'g') | endif
7164
let contents = [
7265
\' {',
7366
\' "configurations": {',
@@ -82,8 +75,7 @@ function! OmniSharp#actions#project#CreateDebugConfig(stopAtEntry, ...) abort
8275
\' "adapter": "netcoredbg",',
8376
\' "configuration": {',
8477
\' "request": "launch",',
85-
\' "cwd": "' . folderWithAppConfigFiles . '",',
86-
\' "program": "' . targetProgramFilename . '",',
78+
\' "program": "'.programPath.'",',
8779
\' "args": ' . json_encode(a:args) . ',',
8880
\' "stopAtEntry": ' . (a:stopAtEntry ? 'true' : 'false'),
8981
\' }',

0 commit comments

Comments
 (0)