From c60cb7a1003a0a849a0303ddd9c29d2d75408115 Mon Sep 17 00:00:00 2001 From: Nicolas Mattia Date: Wed, 16 Mar 2022 05:42:57 +0100 Subject: [PATCH] Make sure config is not nil (#836) This ensures that the config is at least `{}` and never `nil`. Otherwise, calling `cmp.setup()` errors out. --- lua/cmp/config.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lua/cmp/config.lua b/lua/cmp/config.lua index 0353444..2a95cf4 100644 --- a/lua/cmp/config.lua +++ b/lua/cmp/config.lua @@ -157,6 +157,10 @@ end ---@param c cmp.ConfigSchema ---@return cmp.ConfigSchema config.normalize = function(c) + + -- make sure c is not 'nil' + local c = c == nil and {} or c + if c.mapping then local normalized = {} for k, v in pairs(c.mapping) do