summaryrefslogtreecommitdiff
path: root/autoload/ale/lsp_linter.vim
diff options
context:
space:
mode:
Diffstat (limited to 'autoload/ale/lsp_linter.vim')
-rw-r--r--autoload/ale/lsp_linter.vim24
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