diff options
author | Jon Parise <jon@indelible.org> | 2021-09-04 18:07:53 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-05 10:07:53 +0900 |
commit | 8fd23f4b716a36a0a4b56ae34f6e6a4ab8979045 (patch) | |
tree | e8ed6b3272a0475469fc9be8f01cadf9a2bfebbb /autoload | |
parent | b9fdb91e9294b091a56a9da0b8ae705490cd95c6 (diff) | |
download | ale-8fd23f4b716a36a0a4b56ae34f6e6a4ab8979045.zip |
Introduce an ALELSPStarted autocommand (#3878)
This User autocommand is trigged immediately after an LSP process is
successfully initialized. This provides a way to perform any additional
initialization work, such as setting up buffer-level mappings.
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/lsp_linter.vim | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/autoload/ale/lsp_linter.vim b/autoload/ale/lsp_linter.vim index b8885f31..ad181912 100644 --- a/autoload/ale/lsp_linter.vim +++ b/autoload/ale/lsp_linter.vim @@ -271,6 +271,30 @@ function! ale#lsp_linter#OnInit(linter, details, Callback) abort call ale#lsp#NotifyForChanges(l:conn_id, l:buffer) endif + " Tell the relevant buffer that the LSP has started via an autocmd. + if l:buffer > 0 + if l:buffer == bufnr('') + silent doautocmd <nomodeline> User ALELSPStarted + else + execute 'augroup ALELSPStartedGroup' . l:buffer + autocmd! + + execute printf( + \ 'autocmd BufEnter <buffer=%d>' + \ . ' doautocmd <nomodeline> User ALELSPStarted', + \ l:buffer + \) + + " Replicate ++once behavior for backwards compatibility. + execute printf( + \ 'autocmd BufEnter <buffer=%d>' + \ . ' autocmd! ALELSPStartedGroup%d', + \ l:buffer, l:buffer + \) + augroup END + endif + endif + call a:Callback(a:linter, a:details) endfunction |