This repository was archived by the owner on Oct 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy pathmanager.lua
More file actions
54 lines (48 loc) · 2.42 KB
/
manager.lua
File metadata and controls
54 lines (48 loc) · 2.42 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
local manager = {}
------------------------------------------------------------------------
-- plugin variables and states --
------------------------------------------------------------------------
-- Global variables table, accessed in scripts as manager.variable_name
manager = {
-- not used for now...
-- canTryCompletion = true,
-- chains = {}, -- here we store validated chains for each buffer
-- activeChain = nil, -- currently used completion chain
insertChar = false, -- flag for InsertCharPre event, turn off imediately when performing completion
insertLeave = false, -- flag for InsertLeave, prevent every completion if true
textHover = false, -- handle auto hover
selected = -1, -- handle selected items in v:complete-items for auto hover
changedTick = 0, -- handle changeTick
confirmedCompletion = false, -- flag for manual confirmation of completion
forceCompletion = false, -- flag for forced manual completion/source change
chainIndex = 1, -- current index in loaded chain
checkGlobalMapping = false -- indication of global mapping is checked or not
}
-- reset manager
-- called on insertEnter
function manager.init()
-- manager.activeChain = nil
manager.insertLeave = false
-- manager.canTryCompletion = true
manager.insertChar = false
manager.textHover = false
manager.selected = -1
manager.confirmedCompletion = false
manager.forceCompletion = false
manager.chainIndex = 1
end
-- TODO: change this when we have proper logger
function manager.debug()
print(
'canTryCompletion = ' .. vim.inspect(manager.canTryCompletion) .. '\n' ..
'insertChar = ' .. vim.inspect(manager.insertChar) .. '\n' ..
'insertLeave = ' .. vim.inspect(manager.insertLeave) .. '\n' ..
'textHover = ' .. vim.inspect(manager.textHover) .. '\n' ..
'selected = ' .. vim.inspect(manager.selected) .. '\n' ..
'changedTick = ' .. vim.inspect(manager.changedTick) .. '\n' ..
'confirmedCompletion = ' .. vim.inspect(manager.confirmedCompletion) .. '\n' ..
'forceCompletion = ' .. vim.inspect(manager.forceCompletion) .. '\n' ..
'chainIndex = ' .. vim.inspect(manager.chainIndex)
)
end
return manager