@@ -14,8 +14,13 @@ local api = vim.api
14
14
local lsp_wait = function ()
15
15
vim .wait (400 )
16
16
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
+ })
19
24
20
25
describe (" e2e" , function ()
21
26
_G ._TEST = true
@@ -236,10 +241,12 @@ describe("e2e", function()
236
241
describe (" cached generator" , function ()
237
242
local actions , null_ls_action
238
243
local mock_params
244
+ local mock_bufnr
239
245
before_each (function ()
240
246
c .register (builtins ._test .cached_code_action )
241
247
tu .edit_test_file (" test-file.lua" )
242
248
lsp_wait ()
249
+ mock_bufnr = vim .api .nvim_get_current_buf ()
243
250
mock_params = { textDocument = { uri = vim .uri_from_bufnr () } }
244
251
require (" null-ls.state" ).clear_cache (vim .uri_from_bufnr ())
245
252
actions = lsp .buf_request_sync (api .nvim_get_current_buf (), methods .lsp .CODE_ACTION , mock_params )
@@ -257,9 +264,9 @@ describe("e2e", function()
257
264
258
265
it (" should reset cache when file is edited" , function ()
259
266
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')" })
261
268
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 )
263
270
null_ls_action = actions [1 ].result [1 ]
264
271
265
272
assert .equals (null_ls_action .title , " Not cached" )
0 commit comments