diff options
author | Gregory Anders <greg@gpanders.com> | 2022-05-09 12:00:27 -0600 |
---|---|---|
committer | Gregory Anders <greg@gpanders.com> | 2022-05-18 11:21:00 -0600 |
commit | 2ffafc7aa91fb1d9a71fff12051e40961a7b7f69 (patch) | |
tree | a0a685d8a7b04e2435dc3c6ce4b5e9c9165ed121 /runtime/lua/vim/shared.lua | |
parent | 8a9ab88945cdabcbd23f23406353ec6110fefa83 (diff) | |
download | rneovim-2ffafc7aa91fb1d9a71fff12051e40961a7b7f69.tar.gz rneovim-2ffafc7aa91fb1d9a71fff12051e40961a7b7f69.tar.bz2 rneovim-2ffafc7aa91fb1d9a71fff12051e40961a7b7f69.zip |
feat(lsp): add LspAttach and LspDetach autocommands
The current approach of using `on_attach` callbacks for configuring
buffers for LSP is suboptimal:
1. It does not use the standard Nvim interface for driving and hooking
into events (i.e. autocommands)
2. There is no way for "third parties" (e.g. plugins) to hook into the
event. This means that *all* buffer configuration must go into the
user-supplied on_attach callback. This also makes it impossible for
these configurations to be modular, since it all must happen in the
same place.
3. There is currently no way to do something when a client detaches from
a buffer (there is no `on_detach` callback).
The solution is to use the traditional method of event handling in Nvim:
autocommands. When a LSP client is attached to a buffer, fire a
`LspAttach`. Likewise, when a client detaches from a buffer fire a
`LspDetach` event.
This enables plugins to easily add LSP-specific configuration to buffers
as well as enabling users to make their own configurations more modular
(e.g. by creating multiple LspAttach autocommands that each do
something unique).
Diffstat (limited to 'runtime/lua/vim/shared.lua')
0 files changed, 0 insertions, 0 deletions