From b9aba71090029d0ca1053ca9e0026d9b6dd630ca Mon Sep 17 00:00:00 2001 From: Georgi Dimitrov Date: Mon, 11 Nov 2019 14:48:01 +0000 Subject: [PATCH] Fix regex for structs when expanding vars in debug - Allow pointers. - Allow hyphens, underscores and forward slashes in struct names as they might be coming from external packages. - Make the `{...}` bit optional as it doesn't always appear. --- autoload/go/debug.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/go/debug.vim b/autoload/go/debug.vim index 8df358daf6..06b981d159 100644 --- a/autoload/go/debug.vim +++ b/autoload/go/debug.vim @@ -326,10 +326,10 @@ endfunction function! s:expand_var() abort " Get name from struct line. - let name = matchstr(getline('.'), '^[^:]\+\ze: [a-zA-Z0-9\.ยท]\+{\.\.\.}$') + let name = matchstr(getline('.'), '^[^:]\+\ze: \*\?[a-zA-Z0-9-_/\.]\+\({\.\.\.}\)\?$') " Anonymous struct if name == '' - let name = matchstr(getline('.'), '^[^:]\+\ze: struct {.\{-}}$') + let name = matchstr(getline('.'), '^[^:]\+\ze: \*\?struct {.\{-}}$') endif if name != ''