@@ -1993,35 +1993,26 @@ local function setup_neoconf(config)
19931993end
19941994
19951995--- @param schema table<string,SchemaElement> | SchemaElement[]
1996- --- @param user_config table<string,any>
19971996--- @return table
1998- local function build_config (schema , user_config )
1997+ local function build_config (schema )
19991998 --- @type table<string,any>
20001999 local config = {}
20012000
20022001 for _ , elem in ipairs (schema ) do
20032002 local key = elem .name
2004- local user_value = user_config [key ]
2005- local value_type = type (user_value )
20062003
20072004 if elem .type .config_type == " section" then
2008- if value_type == " table" then
2009- config [key ] = build_config (elem .fields , user_value )
2010- else
2011- config [key ] = build_config (elem .fields , {})
2012- end
2005+ config [key ] = build_config (elem .fields )
20132006 else
2014- if matches_type (value_type , elem .type ) then
2015- config [key ] = user_value
2016- else
2017- config [key ] = elem .default
2018- end
2007+ config [key ] = elem .default
20192008 end
20202009 end
20212010
20222011 return config
20232012end
20242013
2014+ local current_config = build_config (M .schema )
2015+
20252016--- comment
20262017--- @param user_config table<string,any> ?
20272018--- @return Config
@@ -2035,11 +2026,11 @@ function M.build(user_config)
20352026
20362027 handle_deprecated ({}, M .schema , user_config , user_config )
20372028 validate_schema ({}, M .schema , user_config )
2038- local config = build_config ( M . schema , user_config )
2039- if config .neoconf .enabled then
2040- return setup_neoconf (config )
2029+ current_config = vim . tbl_deep_extend ( " force " , current_config , user_config )
2030+ if current_config .neoconf .enabled then
2031+ return setup_neoconf (current_config )
20412032 else
2042- return config
2033+ return current_config
20432034 end
20442035end
20452036
0 commit comments