Skip to content

Commit a2dfe5b

Browse files
committed
test: added flags for lspconfig
1 parent a55b7cf commit a2dfe5b

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

test/spec/e2e_spec.lua

+11-4
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,13 @@ local api = vim.api
1414
local lsp_wait = function()
1515
vim.wait(400)
1616
end
17-
18-
main.setup()
17+
main.config()
18+
require("lspconfig")["null-ls"].setup({
19+
flags = {
20+
debounce_text_changes = nil,
21+
allow_incremental_sync = true,
22+
},
23+
})
1924

2025
describe("e2e", function()
2126
_G._TEST = true
@@ -236,10 +241,12 @@ describe("e2e", function()
236241
describe("cached generator", function()
237242
local actions, null_ls_action
238243
local mock_params
244+
local mock_bufnr
239245
before_each(function()
240246
c.register(builtins._test.cached_code_action)
241247
tu.edit_test_file("test-file.lua")
242248
lsp_wait()
249+
mock_bufnr = vim.api.nvim_get_current_buf()
243250
mock_params = { textDocument = { uri = vim.uri_from_bufnr() } }
244251
require("null-ls.state").clear_cache(vim.uri_from_bufnr())
245252
actions = lsp.buf_request_sync(api.nvim_get_current_buf(), methods.lsp.CODE_ACTION, mock_params)
@@ -257,9 +264,9 @@ describe("e2e", function()
257264

258265
it("should reset cache when file is edited", function()
259266
assert.equals(null_ls_action.title, "Not cached")
260-
api.nvim_buf_set_lines(api.nvim_get_current_buf(), 0, 0, false, { "print('new content')" })
267+
api.nvim_buf_set_lines(mock_bufnr, 0, 1, false, { "print('new content')" })
261268
lsp_wait()
262-
actions = lsp.buf_request_sync(api.nvim_get_current_buf(), methods.lsp.CODE_ACTION, mock_params)
269+
actions = lsp.buf_request_sync(mock_bufnr, methods.lsp.CODE_ACTION, mock_params)
263270
null_ls_action = actions[1].result[1]
264271

265272
assert.equals(null_ls_action.title, "Not cached")

0 commit comments

Comments
 (0)