From c7e3f1a0dd447eeafcbbd158974860c1918dbdd5 Mon Sep 17 00:00:00 2001 From: Horacio Sanson Date: Fri, 15 Oct 2021 08:42:07 +0900 Subject: Fix 3207 - do not send didSave notification if not supported (#3930) --- test/lsp/test_did_save_event.vader | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test') diff --git a/test/lsp/test_did_save_event.vader b/test/lsp/test_did_save_event.vader index 1d811363..fbec10e5 100644 --- a/test/lsp/test_did_save_event.vader +++ b/test/lsp/test_did_save_event.vader @@ -90,6 +90,30 @@ Given foobar (Some imaginary filetype): Execute(Server should be notified on save): call ale#events#SaveEvent(bufnr('')) + AssertEqual + \ [ + \ [1, 'textDocument/didChange', { + \ 'textDocument': { + \ 'uri': ale#path#ToURI(expand('%:p')), + \ 'version': g:ale_lsp_next_version_id - 1, + \ }, + \ 'contentChanges': [{'text': join(getline(1, '$'), "\n") . "\n"}], + \ }], + \ ], + \ g:message_list + +Execute(Server should be notified on save with didSave is supported by server): + + " Replace has capability function to simulate didSave server capability + function! ale#lsp#HasCapability(conn_id, capability) abort + if a:capability == 'did_save' + return 1 + endif + return 0 + endfunction + + call ale#events#SaveEvent(bufnr('')) + AssertEqual \ [ \ [1, 'textDocument/didChange', { -- cgit v1.2.3