diff options
author | Michael Lingelbach <m.j.lbach@gmail.com> | 2021-03-07 17:18:32 -0800 |
---|---|---|
committer | Michael Lingelbach <m.j.lbach@gmail.com> | 2021-03-09 20:14:08 -0800 |
commit | e4e51c69d740eb7dc4f3bf0479a92ac6442d979a (patch) | |
tree | 2c57ee29c483355ba631234a7fd7ea241c8d45dd /test/functional/plugin | |
parent | c12ea02e0b5d465e2c4b7d8bba028d069bdf7008 (diff) | |
download | rneovim-e4e51c69d740eb7dc4f3bf0479a92ac6442d979a.tar.gz rneovim-e4e51c69d740eb7dc4f3bf0479a92ac6442d979a.tar.bz2 rneovim-e4e51c69d740eb7dc4f3bf0479a92ac6442d979a.zip |
lsp: add incremental text synchronization
* Implementation derived from and validated by vim-lsc authored by Nate
Bosch
Diffstat (limited to 'test/functional/plugin')
-rw-r--r-- | test/functional/plugin/lsp_spec.lua | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua index 8ac81daeef..115ef74c37 100644 --- a/test/functional/plugin/lsp_spec.lua +++ b/test/functional/plugin/lsp_spec.lua @@ -27,10 +27,10 @@ teardown(function() os.remove(fake_lsp_logfile) end) -local function fake_lsp_server_setup(test_name, timeout_ms) +local function fake_lsp_server_setup(test_name, timeout_ms, options) exec_lua([=[ lsp = require('vim.lsp') - local test_name, fixture_filename, logfile, timeout = ... + local test_name, fixture_filename, logfile, timeout, options = ... TEST_RPC_CLIENT_ID = lsp.start_client { cmd_env = { NVIM_LOG_FILE = logfile; @@ -52,18 +52,19 @@ local function fake_lsp_server_setup(test_name, timeout_ms) on_init = function(client, result) TEST_RPC_CLIENT = client vim.rpcrequest(1, "init", result) + client.config.flags.allow_incremental_sync = options.allow_incremental_sync or false end; on_exit = function(...) vim.rpcnotify(1, "exit", ...) end; } - ]=], test_name, fake_lsp_code, fake_lsp_logfile, timeout_ms or 1e3) + ]=], test_name, fake_lsp_code, fake_lsp_logfile, timeout_ms or 1e3, options or {}) end local function test_rpc_server(config) if config.test_name then clear() - fake_lsp_server_setup(config.test_name, config.timeout_ms or 1e3) + fake_lsp_server_setup(config.test_name, config.timeout_ms or 1e3, config.options) end local client = setmetatable({}, { __index = function(_, name) @@ -680,8 +681,7 @@ describe('LSP', function() } end) - -- TODO(askhan) we don't support full for now, so we can disable these tests. - pending('should check the body and didChange incremental', function() + it('should check the body and didChange incremental', function() local expected_callbacks = { {NIL, "shutdown", {}, 1}; {NIL, "finish", {}, 1}; @@ -690,6 +690,7 @@ describe('LSP', function() local client test_rpc_server { test_name = "basic_check_buffer_open_and_change_incremental"; + options = { allow_incremental_sync = true }; on_setup = function() exec_lua [[ BUFFER = vim.api.nvim_create_buf(false, true) @@ -716,7 +717,7 @@ describe('LSP', function() if method == 'start' then exec_lua [[ vim.api.nvim_buf_set_lines(BUFFER, 1, 2, false, { - "boop"; + "123boop"; }) ]] client.notify('finish') |