Commit dcc2c7c 1 parent ec3a5a3 commit dcc2c7c Copy full SHA for dcc2c7c
File tree 5 files changed +55
-55
lines changed
5 files changed +55
-55
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ dap.configurations.cpp = {
17
17
end ,
18
18
args = function ()
19
19
local input = vim .fn .input (" Input args: " )
20
- return require (" user.dap.dap-utils " ).str2argtable (input )
20
+ return require (" user.dap.dap-util " ).str2argtable (input )
21
21
end ,
22
22
cwd = ' ${workspaceFolder}' ,
23
23
stopOnEntry = true ,
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ dap.configurations.go = {
43
43
program = " ${file}" ,
44
44
args = function ()
45
45
local input = vim .fn .input (" Input args: " )
46
- return require (" user.dap.dap-utils " ).str2argtable (input )
46
+ return require (" user.dap.dap-util " ).str2argtable (input )
47
47
end ,
48
48
},
49
49
{
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ dap.configurations.python = {
15
15
program = " ${file}" , -- This configuration will launch the current file if used.
16
16
args = function ()
17
17
local input = vim .fn .input (" Input args: " )
18
- return require (" user.dap.dap-utils " ).str2argtable (input )
18
+ return require (" user.dap.dap-util " ).str2argtable (input )
19
19
end ,
20
20
pythonPath = function ()
21
21
local venv_path = os.getenv (" VIRTUAL_ENV" )
Original file line number Diff line number Diff line change 1
1
local M = {}
2
2
local dap = require ' dap'
3
3
4
- function M .reload_continue ()
4
+ -- refresh config
5
+ M .reload_continue = function ()
5
6
package.loaded [' user.dap.dap-config' ] = nil
6
7
require (' user.dap.dap-config' ).setup ()
7
8
dap .continue ()
8
9
end
9
10
11
+ -- support passing args
12
+ M .find_next_start = function (str , cur_idx )
13
+ while cur_idx <= # str and str :sub (cur_idx , cur_idx ) == ' ' do
14
+ cur_idx = cur_idx + 1
15
+ end
16
+ return cur_idx
17
+ end
18
+
19
+ M .str2argtable = function (str )
20
+ -- trim spaces
21
+ str = string.gsub (str , ' ^%s*(.-)%s*$' , ' %1' )
22
+ local arg_list = {}
23
+
24
+ local start = 1
25
+ local i = 1
26
+ local quote_refs_cnt = 0
27
+ while i <= # str do
28
+ local c = str :sub (i , i )
29
+ if c == ' "' then
30
+ quote_refs_cnt = quote_refs_cnt + 1
31
+ start = i
32
+ i = i + 1
33
+ -- find next quote
34
+ while i <= # str and str :sub (i , i ) ~= ' "' do
35
+ i = i + 1
36
+ end
37
+ if i <= # str then
38
+ quote_refs_cnt = quote_refs_cnt - 1
39
+ arg_list [# arg_list + 1 ] = str :sub (start , i )
40
+ start = M .find_next_start (str , i + 1 )
41
+ i = start
42
+ end
43
+ -- find next start
44
+ elseif c == ' ' then
45
+ arg_list [# arg_list + 1 ] = str :sub (start , i - 1 )
46
+ start = M .find_next_start (str , i + 1 )
47
+ i = start
48
+ else
49
+ i = i + 1
50
+ end
51
+ end
52
+
53
+ -- add last arg if possiable
54
+ if start ~= i and quote_refs_cnt == 0 then
55
+ arg_list [# arg_list + 1 ] = str :sub (start , i )
56
+ end
57
+ return arg_list
58
+ end
59
+
60
+
10
61
return M
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments