fatih / vim-go

Go development plugin for Vim
https://www.patreon.com/bhcleek
Other
15.9k stars 1.45k forks source link

Syntax highlighting may be disabled by "'redrawtime' exceeded" when `re=1` #3583

Open sugymt opened 10 months ago

sugymt commented 10 months ago

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

  1. Setup env.

    sudo docker run --rm -it ubuntu:22.04 /bin/bash
    
    cd
    
    apt update
    apt install -y vim curl git
    
    curl -LO https://go.dev/dl/go1.21.1.linux-amd64.tar.gz
    tar xzf go1.21.1.linux-amd64.tar.gz
    mv go go1.21.1
    export PATH="$HOME/go1.21.1/bin:$PATH"
    
    git clone https://github.com/fatih/vim-go.git ~/.vim/pack/plugins/start/vim-go
    vim +GoInstallBinaries +q
    
    echo "set re=1" > ~/.vimrc
    echo "let g:go_highlight_function_calls = 1" >> ~/.vimrc
    
    echo "// aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" > main.go
  2. Open the file. vim main.go
  3. Insert '[' between the first 'a' and the second 'a'. :%s/ a/ a[/

What did you expect to happen?

vim and vim-go continues to work normally.

What happened instead?

"'redrawtime' exceeded, syntax highlighting disabled" is displayed and syntax highlighting is disabled.

This problem could be avoided by either of the following methods:

Probably caused by https://github.com/fatih/vim-go/pull/3397

MacOS users may run into this problem because vim defaults to re=1 .

Configuration (MUST fill this out):

vim-go version:

v1.28

vimrc you used to reproduce:

vimrc ```vim set re=1 let g:go_highlight_function_calls = 1 ```

Vim version (first three lines from :version):

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Aug 18 2023 04:12:26) Included patches: 1-3995, 4563, 4646, 4774, 4895, 4899, 4901, 4919, 213 Modified by team+vim@tracker.debian.org

Go version (go version):

go version go1.21.1 linux/amd64

Go environment

go env Output:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/root/.cache/go-build'
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/root/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/root/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/root/go1.21.1'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/root/go1.21.1/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.1'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='0'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2582224566=/tmp/go-build -gno-record-gcc-switches'

gopls version

gopls version Output:

golang.org/x/tools/gopls v0.13.2
    golang.org/x/tools/gopls@v0.13.2 h1:Pyvx6MKvatbX3zzZmdGiFRfQZl0ohPlt2sFxO/5j6Ro=
sugymt commented 10 months ago

I don't know if this issue can be avoided by changing the implementation, but I hope that if re=0 or re=2 is recommended, it will be documented.

bhcleek commented 10 months ago

Yes, this has come up a few times. A FAQ entry seems appropriate.

nidhi-singh02 commented 9 months ago

Do we wish to add this to the documentation ? I could help.

bhcleek commented 9 months ago

@nidhi-singh02 yes, I'd like to add this to the FAQ section in https://github.com/fatih/vim-go/blob/master/doc/vim-go.txt. I would welcome a PR if you want to submit it.