Skip to content

Commit b8f7075

Browse files
committed
debug: make local variables load config configurable
1 parent a64d097 commit b8f7075

3 files changed

Lines changed: 21 additions & 3 deletions

File tree

autoload/go/config.vim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,10 @@ function! go#config#LspLog() abort
217217
return g:go_lsp_log
218218
endfunction
219219

220+
function! go#config#DebugLocalVariablesLoadConfig() abort
221+
return get(g:, 'go_debug_local_variables_load_config', {'MaxStringLen': 20, 'MaxArrayValues': 20, 'MaxVariableRecurse': 10})
222+
endfunction
223+
220224
function! go#config#SetDebugDiag(value) abort
221225
let g:go_debug_diag = a:value
222226
endfunction

autoload/go/debug.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1242,7 +1242,7 @@ function! s:update_variables() abort
12421242
" MaxStructFields is the maximum number of fields read from a struct, -1 will read all fields.
12431243
let l:cfg = {
12441244
\ 'scope': {'GoroutineID': s:goroutineID()},
1245-
\ 'cfg': {'MaxStringLen': 20, 'MaxArrayValues': 20, 'MaxVariableRecurse': 10}
1245+
\ 'cfg': go#config#DebugLocalVariablesLoadConfig()
12461246
\ }
12471247

12481248
try

doc/vim-go.txt

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2481,22 +2481,36 @@ will suppress logging entirely. Default: `'debugger,rpc'`:
24812481
let g:go_debug_log_output = 'debugger,rpc'
24822482
<
24832483

2484-
*'g:go_highlight_debug'*
2484+
*'g:go_highlight_debug'*
24852485

24862486
Highlight the current line and breakpoints in the debugger.
24872487

24882488
>
24892489
let g:go_highlight_debug = 1
24902490
<
24912491

2492-
*'go:go_debug_breakpoint_sign_text'*
2492+
*'g:go_debug_breakpoint_sign_text'*
24932493

24942494
Set the sign text used for breakpoints in the debugger. By default it's '>'.
24952495

24962496
>
24972497
let g:go_debug_breakpoint_sign_text = '>'
24982498
<
24992499

2500+
*'g:go_debug_local_variables_load_config'*
2501+
2502+
Set load configuration that is used to retrieve and display local variables in
2503+
the variable window. For details about the values, refer to
2504+
https://pkg.go.dev/github.com/go-delve/delve/service/api#LoadConfig .
2505+
2506+
>
2507+
let g:go_debug_local_variables_load_config = {
2508+
\ 'MaxStringLen': 20,
2509+
\ 'MaxArrayValues': 20,
2510+
\ 'MaxVariableRecurse': 10,
2511+
\ }
2512+
<
2513+
25002514
==============================================================================
25012515
FAQ TROUBLESHOOTING *go-troubleshooting*
25022516

0 commit comments

Comments
 (0)