fatih / vim-go

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

Question about problematic behavior while typing #3490

Closed stefanos82 closed 1 year ago

stefanos82 commented 1 year ago

I'm using Vim 9.0 and I have noticed a rather peculiar behavior that takes place at random.

I combine completor.vim with vim-mucomplete and makes Go development work really smooth.

The only problem is the following errors

Error detected while processing function go#complete#Complete[23]..
<SNR>107_vim_oneshot_handler[6]..completor#action#callback[2]..completor#action#trigger[6]..
<SNR>101_trigger_complete[20]..function go#complete#Complete[23]..
<SNR>107_vim_oneshot_handler[6]..completor#action#callback[2]..completor#action#trigger[6]..
<SNR>101_trigger_complete:line

14:E565: Not allowed to change text or change window

that take place when I have let g:mucomplete#enable_auto_at_startup = 0 enabled; here it's disabled to prevent the aforementioned errors from taking place.

Seems like it happens while typing (thus in Insert mode) which means it attempts to fetch data from an unimported package / module.

Is there anything I could do to remedy this problematic behavior?

It interrupts my thought process as I attempt to solve a problem while testing code.

Please advice.

Specs

OS: Linux debian 5.15.0-2-amd64 #1 SMP Debian 5.15.5-2 (2021-12-18) x86_64 GNU/Linux
Go version: go1.19.4 linux/amd64
gopls: golang.org/x/tools/gopls v0.11.0
    golang.org/x/tools/gopls@v0.11.0 h1:/nvKHdTtePQmrv9XN3gIUN9MOdUrKzO/dcqgbG6x8EY=

Vim info:

VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Nov 30 2022 23:22:47)
Included patches: 1-813
Modified by team+vim@tracker.debian.org
Compiled by team+vim@tracker.debian.org
Huge version with GTK3 GUI.  Features included (+) or not (-):
+acl               +file_in_path      +mouse_urxvt       -tag_any_white
+arabic            +find_in_path      +mouse_xterm       +tcl
+autocmd           +float             +multi_byte        +termguicolors
+autochdir         +folding           +multi_lang        +terminal
-autoservername    -footer            -mzscheme          +terminfo
+balloon_eval      +fork()            +netbeans_intg     +termresponse
+balloon_eval_term +gettext           +num64             +textobjects
+browse            -hangul_input      +packages          +textprop
++builtin_terms    +iconv             +path_extra        +timers
+byte_offset       +insert_expand     +perl              +title
+channel           +ipv6              +persistent_undo   +toolbar
+cindent           +job               +popupwin          +user_commands
+clientserver      +jumplist          +postscript        +vartabs
+clipboard         +keymap            +printer           +vertsplit
+cmdline_compl     +lambda            +profile           +vim9script
+cmdline_hist      +langmap           -python            +viminfo
+cmdline_info      +libcall           +python3           +virtualedit
+comments          +linebreak         +quickfix          +visual
+conceal           +lispindent        +reltime           +visualextra
+cryptv            +listcmds          +rightleft         +vreplace
+cscope            +localmap          +ruby              +wildignore
+cursorbind        +lua               +scrollbind        +wildmenu
+cursorshape       +menu              +signs             +windows
+dialog_con_gui    +mksession         +smartindent       +writebackup
+diff              +modify_fname      +sodium            +X11
+digraphs          +mouse             +sound             -xfontset
+dnd               +mouseshape        +spell             +xim
-ebcdic            +mouse_dec         +startuptime       -xpm
+emacs_tags        +mouse_gpm         +statusline        +xsmp_interact
+eval              -mouse_jsbterm     -sun_workshop      +xterm_clipboard
+ex_extra          +mouse_netterm     +syntax            -xterm_save
+extra_search      +mouse_sgr         +tag_binary        
-farsi             -mouse_sysmouse    -tag_old_static    
bhcleek commented 1 year ago

I'm not familiar with those plugins, but I noticed that completor.vim use gocode for completion. gocode is unmaintained and the Go community moved on from it several years ago. In addition, vim-mucomplete claims to try a number of completion engines until one matches. That could also be a problem, because vim-go's completion is asynchronous already, and Vim 8.2.0614 added some restrictions to how windows can be changed while completions are in progress. Those restrictions were somewhat loosened in 8.2.0670, but not fully IIUC.

I'm not sure there's anything that can be done about this, nor am is it clear if the problem is with vim-go or with those other plugins.

stefanos82 commented 1 year ago

I'm not familiar with those plugins, but I noticed that completor.vim use gocode for completion. gocode is unmaintained and the Go community moved on from it several years ago.

Yep, but at the bottom of README there's this: image

That saved me from having that nightmarish behavior.

I guess I could close the ticket now because I said to myself, "let's test it for a while now and if everything goes well, come back here and close the ticket".

Seems like I forgot to do that :laughing: my bad!

All well now, thank you for your reply @bhcleek :+1: much appreciated!