vim-lsp-settings icon indicating copy to clipboard operation
vim-lsp-settings copied to clipboard

Go file gets mangled in conjunction with vim-go

Open markuspeloquin opened this issue 1 month ago • 7 comments

Starting with 19aef037e198fa5694b98a052f23e285bf113550, when used alongside vim-go, my files get extra package lines prepended, but only when it's the first file specified on the command line:

Image

Similarly, on a new file, I see this: Image

I previously opened fatih/vim-go#3734, but I closed that when I determined it was vim-lsp-settings, the one thing I didn't look closely at before.

markuspeloquin avatar Nov 18 '25 20:11 markuspeloquin

To reproduce:

" .vimrc
call plug#begin('~/.vim/plugged')
Plug 'prabirshrestha/vim-lsp'
Plug 'mattn/vim-lsp-settings'
Plug 'fatih/vim-go'
call plug#end()
% vim blah.go

markuspeloquin avatar Nov 18 '25 21:11 markuspeloquin

Same problem here. Commenting out https://github.com/mattn/vim-lsp-settings/blob/master/autoload/lsp_settings.vim#L660 to work around it.

wungad avatar Nov 27 '25 03:11 wungad

I don't reproduce this. Which plugin manager do you use?

mattn avatar Nov 27 '25 04:11 mattn

Or do you solve with following patch?

diff --git a/autoload/lsp_settings.vim b/autoload/lsp_settings.vim
index 61739d2..e4cef1a 100644
--- a/autoload/lsp_settings.vim
+++ b/autoload/lsp_settings.vim
@@ -614,7 +614,14 @@ function! lsp_settings#clear() abort
   let s:ftmap = {}
 endfunction
 
+let s:initialized = 0
+
 function! lsp_settings#init() abort
+  if s:initialized
+    return
+  endif
+  let s:initialized = 1
+
   for [l:name, l:server] in items(get(g:, 'lsp_settings', {}))
     if !has_key(l:server, 'allowlist')
       continue

mattn avatar Nov 27 '25 04:11 mattn

Unfortunately it does not solve it. The plugin manager I've been using is vim-plug (default settings).

wungad avatar Nov 28 '25 00:11 wungad

Do you use on or for directive of vim-plug ?

mattn avatar Nov 28 '25 01:11 mattn

I am also using vim-plug. For now I'm just using the previous commit (plus restart, then :PlugUpdate, restart again):

Plug 'mattn/vim-lsp-settings', {'commit': '822c0ac'}

Edit I do not use on or for.

markuspeloquin avatar Dec 01 '25 07:12 markuspeloquin