nvim-lspconfig icon indicating copy to clipboard operation
nvim-lspconfig copied to clipboard

LspStop should remove related autocmds

Open lbrayner opened this issue 2 years ago • 3 comments

Language server

No response

Requested feature

LspStop doesn't deal with the autocmds created by setup or launch. I think it'd be better to delete them, so that, after an LspStop, when you open another file that matches either the FileType or BufReadPost event patterns, the LS is NOT launched again, which is a bit unexpected to the unaware user.

It can be argued that this is only necessary is autostart is false.

Other clients which have this feature

No response

lbrayner avatar Oct 24 '22 18:10 lbrayner

I am not sure if this is 100% correct, but this issue becomes irritating as it always pop up a warning for BufReadPost concerning an invalid character in the group name:

Erreur détectée en traitant Autocommandes BufReadPost pour "*" :                                                               
W18: Caractère invalide dans un nom de groupe                                                                                  
Appuyez sur ENTRÉE ou tapez une commande pour continuer                                                                        
Erreur détectée en traitant Autocommandes BufReadPost pour "*" :                                                               
W18: Caractère invalide dans un nom de groupe                                                                                  
Appuyez sur ENTRÉE ou tapez une commande pour continuer                                                           

I think the offending lines are where the autocmd is defined: https://github.com/neovim/nvim-lspconfig/blob/67f0d0025b118e7e328396d7732d97415a9afda4/lua/lspconfig/configs.lua#L69-L72

rfc2119 avatar Oct 31 '22 09:10 rfc2119

I found :au! lspconfig after :LspStop is a good work-around for the time being.

dietrichm avatar Jun 03 '23 15:06 dietrichm