@@ -59,10 +59,29 @@ local function insertArray(conf, temp)
5959 }
6060end
6161
62- local function insertHash (conf , temp )
63- conf .additionalProperties = false
64- if not temp .subkey .enums then
65- if temp .subvalue .enums then
62+ local function insertHash (name , conf , temp )
63+ conf .title = name :match ' [^%.]+$'
64+
65+ if type (conf .default ) == ' table' and next (conf .default ) then
66+ conf .additionalProperties = false
67+ local default = conf .default
68+ conf .default = nil
69+ conf .properties = {}
70+ local descHead = name :gsub (' ^Lua' , ' %%config' )
71+ if util .stringStartWith (descHead , ' %config.diagnostics' ) then
72+ descHead = ' %config.diagnostics'
73+ end
74+ for key , value in pairs (default ) do
75+ conf .properties [key ] = {
76+ type = getType ( temp .subvalue ),
77+ default = value ,
78+ enum = getEnum ( temp .subvalue ),
79+ description = descHead .. ' .' .. key .. ' %' ,
80+ }
81+ end
82+ else
83+ if temp .subvalue .enums then
84+ conf .additionalProperties = false
6685 conf .patternProperties = {
6786 [' .*' ] = {
6887 type = getType ( temp .subvalue ),
@@ -95,7 +114,7 @@ for name, temp in pairs(template) do
95114 end
96115
97116 if temp .name == ' Hash' then
98- insertHash (config [name ], temp )
117+ insertHash (name , config [name ], temp )
99118 end
100119
101120 :: CONTINUE::
0 commit comments