blob: a5fecac38bc5dc01abd02073d0f525816958a4df (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
local FileChangeType = {
Created = 1,
Changed = 2,
Deleted = 3,
}
return function (lsp, params)
if not lsp.workspace then
return
end
local needReset
for _, change in ipairs(params.changes) do
if change.type == FileChangeType.Created then
lsp.workspace:addFile(change.uri)
elseif change.type == FileChangeType.Deleted then
lsp.workspace:removeFile(change.uri)
end
if lsp:getVM(change.uri) then
needReset = true
end
end
-- 缓存过的文件发生变化后,重新计算
if needReset then
lsp.workspace:reset()
end
end
|