@@ -201,14 +201,14 @@ class AutodocUtilsMixin(sphinx_lua_ls.domain.LuaContextManagerMixin):
201201 """
202202
203203 option_spec : ClassVar [dict [str , Callable [[str ], Any ]]] = { # type: ignore
204- "members" : utils .parse_list_option ,
205- "undoc-members" : utils .parse_list_option ,
206- "private-members" : utils .parse_list_option ,
207- "protected-members" : utils .parse_list_option ,
208- "package-members" : utils .parse_list_option ,
209- "special-members" : utils .parse_list_option ,
210- "inherited-members" : utils .parse_list_option ,
211- "exclude-members" : utils .parse_list_option ,
204+ "members" : utils .parse_list_option_or_true ,
205+ "undoc-members" : utils .parse_list_option_or_true ,
206+ "private-members" : utils .parse_list_option_or_true ,
207+ "protected-members" : utils .parse_list_option_or_true ,
208+ "package-members" : utils .parse_list_option_or_true ,
209+ "special-members" : utils .parse_list_option_or_true ,
210+ "inherited-members" : utils .parse_list_option_or_true ,
211+ "exclude-members" : utils .parse_list_option_or_true ,
212212 "title" : directives .unchanged ,
213213 "index-title" : directives .unchanged ,
214214 "recursive" : directives .flag ,
@@ -220,7 +220,7 @@ class AutodocUtilsMixin(sphinx_lua_ls.domain.LuaContextManagerMixin):
220220 "module-member-order" : lambda x : directives .choice (
221221 x , ("alphabetical" , "groupwise" , "bysource" )
222222 ),
223- "globals" : utils .parse_list_option ,
223+ "globals" : utils .parse_list_option_or_true ,
224224 "class-doc-from" : lambda x : directives .choice (
225225 x , ("class" , "both" , "ctor" , "separate" , "none" )
226226 ),
@@ -232,8 +232,14 @@ class AutodocUtilsMixin(sphinx_lua_ls.domain.LuaContextManagerMixin):
232232 ),
233233 "require-function-name" : directives .unchanged ,
234234 "require-separator" : directives .unchanged ,
235- ** sphinx_lua_ls .domain .LuaObject .option_spec ,
236235 }
236+ option_spec .update (
237+ {
238+ f"no-{ key } " : directives .flag
239+ for key in sphinx_lua_ls .domain .GLOBAL_OPTIONS & set (option_spec )
240+ }
241+ )
242+ option_spec .update (sphinx_lua_ls .domain .LuaObject .option_spec )
237243
238244 def render (self , root : Object , name : str , top_level : bool = False ):
239245 if root .kind is None :
@@ -383,25 +389,39 @@ def _create_directive(
383389 top_level : bool = False ,
384390 ) -> SphinxDirective :
385391 if top_level :
386- options = self .options .copy ()
392+ options = self .orig_options .copy ()
387393 options .pop ("module" , None )
388394 else :
389395 options = {}
390396 for key in [
391397 "member-order" ,
398+ "no-member-order" ,
392399 "module-member-order" ,
400+ "no-module-member-order" ,
393401 "recursive" ,
402+ "no-recursive" ,
394403 "no-index" ,
404+ "no-no-index" ,
405+ "no-index-entry" ,
406+ "no-no-index-entry" ,
407+ "no-contents-entry" ,
408+ "no-no-contents-entry" ,
395409 "inherited-members-table" ,
410+ "no-inherited-members-table" ,
396411 "class-doc-from" ,
412+ "no-class-doc-from" ,
397413 "class-signature" ,
414+ "no-class-signature" ,
398415 "annotate-require" ,
416+ "no-annotate-require" ,
399417 "require-function-name" ,
418+ "no-require-function-name" ,
400419 "require-separator" ,
420+ "no-require-separator" ,
401421 ]:
402- if key in self .options :
403- options [key ] = self .options [key ]
404- if "recursive" in self .options :
422+ if key in self .orig_options :
423+ options [key ] = self .orig_options [key ]
424+ if "recursive" in self .orig_options :
405425 for key in [
406426 "members" ,
407427 "globals" ,
@@ -411,9 +431,17 @@ def _create_directive(
411431 "package-members" ,
412432 "special-members" ,
413433 "inherited-members" ,
434+ "using" ,
414435 ]:
415- if key in self .options and self .options [key ] is True :
416- options [key ] = self .options [key ]
436+ if key in self .orig_options :
437+ if self .orig_options [key ] is True :
438+ options [key ] = self .orig_options [key ]
439+ elif (
440+ self .orig_options [key ] and self .orig_options [key ][0 ] == "+"
441+ ):
442+ options [key ] = self .orig_options [key ]
443+ if f"no-{ key } " in self .orig_options :
444+ options [f"no-{ key } " ] = self .orig_options [f"no-{ key } " ]
417445
418446 match root .visibility :
419447 case Visibility .Private :
@@ -939,9 +967,7 @@ class AutoObjectDirective(AutodocUtilsMixin):
939967 has_content = True
940968
941969 def run (self ):
942- for name , option in self .lua_domain .config .default_options .items ():
943- if name not in self .options :
944- self .options [name ] = option
970+ self .prepare_options ()
945971
946972 name = self .arguments [0 ].strip ()
947973
0 commit comments