summaryrefslogtreecommitdiff
path: root/test/lsp
diff options
context:
space:
mode:
authorHoracio Sanson <hsanson@gmail.com>2021-10-15 08:42:07 +0900
committerGitHub <noreply@github.com>2021-10-15 08:42:07 +0900
commitc7e3f1a0dd447eeafcbbd158974860c1918dbdd5 (patch)
tree54ccfbe683256ae981f0633b084ae4545274229c /test/lsp
parent7413dfd3fc386920217fb43e9a517e99d9cf42b8 (diff)
downloadale-c7e3f1a0dd447eeafcbbd158974860c1918dbdd5.zip
Fix 3207 - do not send didSave notification if not supported (#3930)
Diffstat (limited to 'test/lsp')
-rw-r--r--test/lsp/test_did_save_event.vader24
1 files changed, 24 insertions, 0 deletions
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
@@ -99,6 +99,30 @@ Execute(Server should be notified on save):
\ },
\ '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', {
+ \ 'textDocument': {
+ \ 'uri': ale#path#ToURI(expand('%:p')),
+ \ 'version': g:ale_lsp_next_version_id - 1,
+ \ },
+ \ 'contentChanges': [{'text': join(getline(1, '$'), "\n") . "\n"}],
+ \ }],
\ [1, 'textDocument/didSave', {
\ 'textDocument': {
\ 'uri': ale#path#ToURI(expand('%:p')),