@@ -57,7 +57,7 @@ local function getScopedChain(ft_subtree)
5757
5858 local atPoint = syntax_getter ():lower ()
5959 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
6161 return complete_list
6262 end
6363 end
@@ -93,18 +93,20 @@ function M.checkHealth(complete_items_map)
9393 else
9494 chain_complete_list = getScopedChain (completion_list .default ) or completion_list .default .default
9595 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" )
102109 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" )
108110 end
109111 end
110112 end
0 commit comments