Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for expanding Pointer slices in debugger #3265

Open
ishankhare07 opened this issue Jul 22, 2021 · 0 comments
Open

Add support for expanding Pointer slices in debugger #3265

ishankhare07 opened this issue Jul 22, 2021 · 0 comments

Comments

@ishankhare07
Copy link

What did you do? (required: The issue will be closed when not provided)

I tried using :GoDebugStart for the following program and the breakpoints at line 14 and 19

    1 package main
    2
    3 import "fmt"
    4
    5 type Complex struct {
    6     Value *int
    7 }
    8
    9 func PointyInt(a int) *int {
   10     return &a
   11 }
   12
   13 func main() {
   14     a := []*Complex{
   15         {
   16             Value: PointyInt(1),
   17         },
   18     }
   19
   20     b := []int{1, 2, 3, 4}
 * 21     fmt.Println("vim-go", a, b)
   22 }

On stepping through the debugger I expect to see the a variable in the Local Variables section:

a: []*main.Complex[824633868568]
b: []int[4]

Up to this point this is the expected outcome, however if I try to expand the a Slice above using the <CR> binding, it doesn't work, while is works perfectly for b.

# Local Variables
a: []*main.Complex[1]
b: []int[4]
 b[0]: int(1)
 b[1]: int(2)
 b[2]: int(3)
 b[3]: int(4)

What did you expect to happen?

I expect even the pointer slices to be expanded in the local variables section

What happened instead?

Cannot expand the variable which is a slice of pointers

Configuration (MUST fill this out):

No custom configuration apart from the vimrc linked below

vim-go version: latest

vimrc you used to reproduce:

vimrc
set nocompatible                " be iMproved, required
filetype plugin indent on       " required

" set syntax highlighting on
syntax on

" set line number on
set number

" turn off line wraping
set nowrap

" enable backspace in vim on mac
set backspace=indent,eol,start

" set options for youcompleteme whitlist files
let g:ycm_filetype_whitelist = {'c': 1, 'cpp': 1, 'python': 1, 'go': 1, 'erlang': 1}

" auto-close ycm preview window after completion
let g:ycm_autoclose_preview_window_after_completion = 1

au BufNewFile,BufRead *.py
    \ set tabstop=4 |
    \ set softtabstop=4 |
    \ set shiftwidth=4 |
    " \ set textwidth=79 |
    \ set expandtab |
    \ set autoindent |
    \ set fileformat=unix |
    \ set formatprg=autopep8\ -|

au BufNewFile,BufRead *.js,*.html,*.css,*.yml,*.yaml,*.tf,*.tfvar
    \ set tabstop=2 |
    \ set softtabstop=2 |
    \ set shiftwidth=2 |
    \ set expandtab |
    \ set autoindent |

au BufNewFile,BufRead *.go
    \ set tabstop=4 |
    \ set softtabstop=4 |
    \ set shiftwidth=4 |
    \ set noexpandtab |
    \ set autoindent |
    \ set smarttab

" go tab settings
"autocmd Filetype *.go set tabstop=4 softtabstop=0 shiftwidth=4 noexpandtab

" allow shortcut for split resizing
nnoremap <c-w>> :vertical resize +10<cr>
nnoremap <c-w>< :vertical resize -10<cr>

" set vim-airline to always appear
set laststatus=2

" vim airline - tabline
let g:airline#extensions#tabline#enabled = 1

" intergate vim-airline with powerline fonts
let g:airline_powerline_fonts = 1

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'

" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.

" Themes
" Plugin 'kristijanhusak/vim-hybrid-material'
" Plugin 'scwood/vim-hybrid'
" Plugin 'vim-airline/vim-airline-themes'
" Plugin 'vim-airline/vim-airline'
" Plugin 'edkolev/tmuxline.vim'

" Plugin 'altercation/vim-colors-solarized'

" typescript highlighting
" Plugin 'clausreinke/typescript-tools.vim'
" Plugin 'leafgarland/typescript-vim'

" Non-themes
" Plugin 'scrooloose/nerdtree'
" Plugin 'Xuyuanp/nerdtree-git-plugin'
" Plugin 'jmcantrell/vim-virtualenv'
" Plugin 'airblade/vim-gitgutter'
" Plugin 'tpope/vim-fugitive'
" Plugin 'Valloric/YouCompleteMe'
" Plugin 'nvie/vim-flake8'
" Plugin 'tell-k/vim-autopep8'

" Plugin 'w0rp/ale'
" Plugin 'luochen1990/rainbow'

" Plugin 'vimwiki/vimwiki'
" Plugin 'kien/ctrlp.vim'

" vim-go
Plugin 'fatih/vim-go'
Plugin 'nsf/gocode', {'rtp': 'vim/'}
Plugin 'sebdah/vim-delve'
" Plugin 'mdempsky/gocode', {'rtp': 'vim/'}

autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif

map <C-f> :NERDTreeToggle<CR>

call vundle#end()            " required
filetype plugin indent on    " required

" first set 256 color support
set t_Co=256

" set dark background
set background=dark

" set colorscheme
colorscheme solarized

" If you don't want airline colors in tmuxline
let g:airline#extensions#tmuxline#enabled = 0

" setting default theme for airline
let g:airline_theme='base16_solarized'

" detect ctrl arrow keys inside tmux
if &term =~ '^screen'
    " tmux will send xterm-style keys when its xterm-keys option is on
    execute "set <xUp>=\e[1;*A"
    execute "set <xDown>=\e[1;*B"
    execute "set <xRight>=\e[1;*C"
    execute "set <xLeft>=\e[1;*D"
endif

set encoding=utf-8

" CtrlP binding
let g:ctrlp_map = '<C-l>'

let g:go_metalinter_enabled = ['vet', 'golint']
let g:go_fmt_command = "goimports"
let g:go_autodetect_gopath = 1
let g:go_list_type = "location list"
" let g:go_metalinter_autosave = 1
let g:go_auto_sameids = 1

let g:go_highlight_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_functions = 1
let g:go_highlight_function_calls = 1
let g:go_highlight_extra_types = 1
let g:go_highlight_generate_tags = 1

let g:go_def_mode='gopls'
let g:go_info_mode='gopls'
let g:go_rename_command='gopls'

let g:ctrlp_show_hidden = 1

let g:terraform_align=1

" Tab navigation like Firefox.
nnoremap <C-p> :bprevious<CR>
map <C-p> :bprevious<CR>
imap <C-p> <Esc>:bprevious<CR>
map <C-n>   :bnext<CR>
imap <C-n>    <Esc>:bnext<CR>
nnoremap <C-t>     :enew<CR>
imap <C-t>  <Esc>:enew<CR>
map <C-q>       :bdelete<CR>
imap <C-q>       :bdelete<CR>
nnoremap <C-q>     :bdelete<CR>
inoremap <C-q>     <Esc>:bdelete<CR>

" remap ; to : when in normal mode
" nnoremap ; :

" ycm autocomplete
set omnifunc=youcompleteme#Complete
set completefunc=youcompleteme#Complete

Vim version (first three lines from :version):

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Apr 01 2021 08:32:44)
macOS version - x86_64
Included patches: 1-2681

Go version (go version):

go version go1.16.5 darwin/amd64

Go environment

go env Output:
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/ishankhare/Library/Caches/go-build"
GOENV="/Users/ishankhare/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/ishankhare/godev/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/ishankhare/godev"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.16.5/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.16.5/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.16.5"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/ishankhare/ishan/helm/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/d_/ts9r3x654zb8x10kxfdfzf_00000gn/T/go-build2088288958=/tmp/go-build -gno-record-gcc-switches -fno-common"

gopls version

gopls version Output:
golang.org/x/tools/gopls v0.7.0
    golang.org/x/tools/[email protected] h1:JQBHW81Gsyim6iDjUwGoPeSpXrSqwen3isPJLfDfaYU=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants