diff --git a/lua/is_in_user_dict.lua b/lua/is_in_user_dict.lua index deecfd7..11d1aba 100644 --- a/lua/is_in_user_dict.lua +++ b/lua/is_in_user_dict.lua @@ -7,19 +7,18 @@ local M = {} function M.init(env) local config = env.engine.schema.config env.name_space = env.name_space:gsub('^*', '') - M.is_in_user_dict = config:get_bool(env.name_space) + M.is_in_user_dict = config:get_bool(env.name_space) or nil end -function M.func(input, env) +local is_user = { + user_table = true, + user_phrase = true, +} + +function M.func(input) for cand in input:iter() do - if M.is_in_user_dict then - if cand.type == "user_phrase" then - cand.comment = cand.comment .. '*' - end - else - if cand.type ~= "user_phrase" then - cand.comment = cand.comment .. '*' - end + if is_user[cand.type] == M.is_in_user_dict then + cand.comment = cand.comment .. '*' end yield(cand) end