Fix 3207 - do not send didSave notification if not supported (#3930)

This commit is contained in:
Horacio Sanson
2021-10-15 08:42:07 +09:00
committed by GitHub
parent 7413dfd3fc
commit c7e3f1a0dd
3 changed files with 37 additions and 7 deletions

View File

@@ -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', {