From 2ac9e2a29e3c570e8aac5d8f5404921e8d816006 Mon Sep 17 00:00:00 2001 From: Jon Parise Date: Tue, 30 Oct 2018 15:47:19 -0700 Subject: Only send LSP config updates when the dict changes Each LSP connection now stores its configuration dictionary. It is initially empty (`{}`) and is updated each time the LSP connection is started. When a change is detected, the workspace/didChangeConfiguration message is sent to the LSP servers with the updated configuration. --- test/lsp/test_other_initialize_message_handling.vader | 1 + test/lsp/test_update_config.vader | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 test/lsp/test_update_config.vader (limited to 'test') diff --git a/test/lsp/test_other_initialize_message_handling.vader b/test/lsp/test_other_initialize_message_handling.vader index e29f3358..98509f82 100644 --- a/test/lsp/test_other_initialize_message_handling.vader +++ b/test/lsp/test_other_initialize_message_handling.vader @@ -7,6 +7,7 @@ Before: \ 'initialized': 0, \ 'init_request_id': 0, \ 'init_options': {}, + \ 'config': {}, \ 'callback_list': [], \ 'message_queue': [], \ 'capabilities_queue': [], diff --git a/test/lsp/test_update_config.vader b/test/lsp/test_update_config.vader new file mode 100644 index 00000000..07068bc8 --- /dev/null +++ b/test/lsp/test_update_config.vader @@ -0,0 +1,17 @@ +Before: + runtime autoload/ale/lsp.vim + + let g:conn_id = ale#lsp#Register('executable', '/foo/bar', {}) + +After: + Restore + + unlet! g:conn_id + + runtime autoload/ale/lsp.vim + +Execute(Only send updates when the configuration dictionary changes): + AssertEqual 0, ale#lsp#UpdateConfig(g:conn_id, bufnr(''), {}) + AssertEqual 1, ale#lsp#UpdateConfig(g:conn_id, bufnr(''), {'a': 1}) + AssertEqual 0, ale#lsp#UpdateConfig(g:conn_id, bufnr(''), {'a': 1}) + AssertEqual 1, ale#lsp#UpdateConfig(g:conn_id, bufnr(''), {}) -- cgit v1.2.3