Commit 680b86f 1 parent fc2af03 commit 680b86f Copy full SHA for 680b86f
File tree 2 files changed +12
-6
lines changed
2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -2,19 +2,27 @@ local next_key = 0
2
2
3
3
local M = {}
4
4
5
- M .cache = {}
5
+ M ._reset = function ()
6
+ M .cache = {}
7
+ end
8
+
9
+ M ._reset ()
6
10
7
11
--- creates a function that caches the output of a callback, indexed by bufnr
8
12
--- @param cb function
9
13
--- @return fun ( params : NullLsParams ): any
10
14
M .by_bufnr = function (cb )
11
15
-- assign next available key, since we just want to avoid collisions
12
16
local key = next_key
13
- M .cache [key ] = {}
14
17
next_key = next_key + 1
15
18
16
19
return function (params )
17
20
local bufnr = params .bufnr
21
+
22
+ if M .cache [key ] == nil then
23
+ M .cache [key ] = {}
24
+ end
25
+
18
26
-- if we haven't cached a value yet, get it from cb
19
27
if M .cache [key ][bufnr ] == nil then
20
28
-- make sure we always store a value so we know we've already called cb
@@ -25,8 +33,4 @@ M.by_bufnr = function(cb)
25
33
end
26
34
end
27
35
28
- M ._reset = function ()
29
- M .cache = {}
30
- end
31
-
32
36
return M
Original file line number Diff line number Diff line change 1
1
local c = require (" null-ls.config" )
2
2
local log = require (" null-ls.logger" )
3
3
local methods = require (" null-ls.methods" )
4
+ local cache = require (" null-ls.helpers" ).cache
4
5
5
6
local notification_cache = {}
6
7
@@ -151,6 +152,7 @@ M.start = function(dispatchers)
151
152
return stopped
152
153
end ,
153
154
terminate = function ()
155
+ cache ._reset ()
154
156
stopped = true
155
157
end ,
156
158
}
You can’t perform that action at this time.
0 commit comments