yegappan / lsp

Language Server Protocol (LSP) plugin for Vim9
MIT License
458 stars 49 forks source link

Add an autocommand event for initialization #455

Closed beavailable closed 6 months ago

beavailable commented 6 months ago

Because I just want lsp to be loaded for certain filetypes (not all), if I want to set options, I could write like this:

au VimEnter * if get(g:, 'loaded_lsp') | call LspOptionsSet({...})  | endif

This works, but if I can write like this:

au LspSetup * call LspOptionsSet({...})

It'll be more convenient.

yegappan commented 6 months ago

Do you want to load the LSP plugin only when certain filetypes are opened? or do you want to LSP options based on the file type?

beavailable commented 6 months ago

I want to load lsp only when certain filetypes are opened, I've done this with vim-plug, so I just need an easy way for initializations like setting options when lsp is loaded.

yegappan commented 6 months ago

I have committed https://github.com/yegappan/lsp/commit/87189faf0bd4a2f974408df2d8c261dbfc3348dd to add support for the LspSetup autocmd. Please try the latest version of the plugin and let me know whether this works for you.

beavailable commented 6 months ago

I just tried and it works perfectly, thank you! And I'm closing this issue.