@@ -57,7 +57,7 @@ local function getScopedChain(ft_subtree)
57
57
58
58
local atPoint = syntax_getter ():lower ()
59
59
for syntax_regex , complete_list in pairs (ft_subtree ) do
60
- if string.match (atPoint , ' .*' .. syntax_regex :lower () .. ' .*' ) ~= nil and syntax_regex ~= " default" then
60
+ if type ( syntax_regex ) == " string " and string.match (atPoint , ' .*' .. syntax_regex :lower () .. ' .*' ) ~= nil and syntax_regex ~= " default" then
61
61
return complete_list
62
62
end
63
63
end
@@ -93,18 +93,20 @@ function M.checkHealth(complete_items_map)
93
93
else
94
94
chain_complete_list = getScopedChain (completion_list .default ) or completion_list .default .default
95
95
end
96
- for _ ,complete_source in ipairs (chain_complete_list ) do
97
- if vim .fn .has_key (complete_source , " complete_items" ) > 0 then
98
- for _ ,item in ipairs (complete_source .complete_items ) do
99
- if complete_items_map [item ] == nil then
100
- health_error (item .. " is not a valid completion source (in filetype " .. filetype .. " )" )
101
- error = true
96
+ if chain_complete_list ~= nil then
97
+ for _ ,complete_source in ipairs (chain_complete_list ) do
98
+ if vim .fn .has_key (complete_source , " complete_items" ) > 0 then
99
+ for _ ,item in ipairs (complete_source .complete_items ) do
100
+ if complete_items_map [item ] == nil then
101
+ health_error (item .. " is not a valid completion source (in filetype " .. filetype .. " )" )
102
+ error = true
103
+ end
104
+ end
105
+ else
106
+ local ins = require ' completion.source.ins_complete'
107
+ if ins .checkHealth (complete_source .mode ) then
108
+ health_error (complete_source .mode .. " is not a valid insert complete mode" )
102
109
end
103
- end
104
- else
105
- local ins = require ' completion.source.ins_complete'
106
- if ins .checkHealth (complete_source .mode ) then
107
- health_error (complete_source .mode .. " is not a valid insert complete mode" )
108
110
end
109
111
end
110
112
end
0 commit comments