From b8f7075b45fbcf9cfa184c0b0f82328c2c9c60b3 Mon Sep 17 00:00:00 2001 From: gremat <50012463+gremat@users.noreply.github.com> Date: Fri, 2 Aug 2024 13:48:55 +0200 Subject: [PATCH] debug: make local variables load config configurable --- autoload/go/config.vim | 4 ++++ autoload/go/debug.vim | 2 +- doc/vim-go.txt | 18 ++++++++++++++++-- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/autoload/go/config.vim b/autoload/go/config.vim index 241551fa52..fda7a22280 100644 --- a/autoload/go/config.vim +++ b/autoload/go/config.vim @@ -217,6 +217,10 @@ function! go#config#LspLog() abort return g:go_lsp_log endfunction +function! go#config#DebugLocalVariablesLoadConfig() abort + return get(g:, 'go_debug_local_variables_load_config', {'MaxStringLen': 20, 'MaxArrayValues': 20, 'MaxVariableRecurse': 10}) +endfunction + function! go#config#SetDebugDiag(value) abort let g:go_debug_diag = a:value endfunction diff --git a/autoload/go/debug.vim b/autoload/go/debug.vim index 523f4b36e9..c51af9ad32 100644 --- a/autoload/go/debug.vim +++ b/autoload/go/debug.vim @@ -1242,7 +1242,7 @@ function! s:update_variables() abort " MaxStructFields is the maximum number of fields read from a struct, -1 will read all fields. let l:cfg = { \ 'scope': {'GoroutineID': s:goroutineID()}, - \ 'cfg': {'MaxStringLen': 20, 'MaxArrayValues': 20, 'MaxVariableRecurse': 10} + \ 'cfg': go#config#DebugLocalVariablesLoadConfig() \ } try diff --git a/doc/vim-go.txt b/doc/vim-go.txt index 5b007c1cde..292d49b30a 100644 --- a/doc/vim-go.txt +++ b/doc/vim-go.txt @@ -2481,7 +2481,7 @@ will suppress logging entirely. Default: `'debugger,rpc'`: let g:go_debug_log_output = 'debugger,rpc' < - *'g:go_highlight_debug'* + *'g:go_highlight_debug'* Highlight the current line and breakpoints in the debugger. @@ -2489,7 +2489,7 @@ Highlight the current line and breakpoints in the debugger. let g:go_highlight_debug = 1 < - *'go:go_debug_breakpoint_sign_text'* + *'g:go_debug_breakpoint_sign_text'* Set the sign text used for breakpoints in the debugger. By default it's '>'. @@ -2497,6 +2497,20 @@ Set the sign text used for breakpoints in the debugger. By default it's '>'. let g:go_debug_breakpoint_sign_text = '>' < + *'g:go_debug_local_variables_load_config'* + +Set load configuration that is used to retrieve and display local variables in +the variable window. For details about the values, refer to +https://pkg.go.dev/github.com/go-delve/delve/service/api#LoadConfig . + +> + let g:go_debug_local_variables_load_config = { + \ 'MaxStringLen': 20, + \ 'MaxArrayValues': 20, + \ 'MaxVariableRecurse': 10, + \ } +< + ============================================================================== FAQ TROUBLESHOOTING *go-troubleshooting*