@@ -402,7 +402,7 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDocsAggregatorTest
402402 assert macro_result . function == "some_macro"
403403 assert macro_result . arity == 2
404404 assert macro_result . documentation =~ "An example macro"
405-
405+
406406 # Check that metadata is included (since: "1.1.0")
407407 assert macro_result . documentation =~ "Since"
408408 assert macro_result . documentation =~ "1.1.0"
@@ -437,7 +437,7 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDocsAggregatorTest
437437 assert macrocallback_result . callback == "some_macrocallback"
438438 assert macrocallback_result . arity == 1
439439 assert macrocallback_result . documentation =~ "An example callback"
440-
440+
441441 # Check that we got the documentation (metadata may be formatted differently for callbacks)
442442 assert macrocallback_result . documentation
443443 end
@@ -459,23 +459,33 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDocsAggregatorTest
459459
460460 test "verifies macro and macrocallback specs are included" do
461461 # Test callback spec
462- assert { :ok , result } = LlmDocsAggregator . execute ( [ [ "ElixirSenseExample.ModuleWithDocs.some_callback/1" ] ] , % { } )
462+ assert { :ok , result } =
463+ LlmDocsAggregator . execute (
464+ [ [ "ElixirSenseExample.ModuleWithDocs.some_callback/1" ] ] ,
465+ % { }
466+ )
467+
463468 assert Map . has_key? ( result , :results )
464469 assert length ( result . results ) == 1
465-
470+
466471 callback_result = hd ( result . results )
467472 assert Map . has_key? ( callback_result , :spec )
468473 assert Map . has_key? ( callback_result , :kind )
469474 assert Map . has_key? ( callback_result , :metadata )
470475 assert callback_result . spec == "@callback some_callback(integer()) :: atom()"
471476 assert callback_result . kind == :callback
472477 assert callback_result . metadata . since == "1.1.0"
473-
478+
474479 # Test macrocallback spec
475- assert { :ok , result } = LlmDocsAggregator . execute ( [ [ "ElixirSenseExample.ModuleWithDocs.some_macrocallback/1" ] ] , % { } )
480+ assert { :ok , result } =
481+ LlmDocsAggregator . execute (
482+ [ [ "ElixirSenseExample.ModuleWithDocs.some_macrocallback/1" ] ] ,
483+ % { }
484+ )
485+
476486 assert Map . has_key? ( result , :results )
477487 assert length ( result . results ) == 1
478-
488+
479489 macrocallback_result = hd ( result . results )
480490 assert Map . has_key? ( macrocallback_result , :spec )
481491 assert Map . has_key? ( macrocallback_result , :kind )
@@ -499,7 +509,7 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDocsAggregatorTest
499509 assert func_result . function == "some_fun"
500510 assert func_result . arity == 2
501511 assert func_result . documentation =~ "An example fun"
502-
512+
503513 # Verify that specs are included in the documentation
504514 assert func_result . documentation =~ "**Specs:**"
505515 assert func_result . documentation =~ "@spec some_fun"
@@ -521,7 +531,7 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDocsAggregatorTest
521531 assert macro_result . function == "some_macro"
522532 assert macro_result . arity == 2
523533 assert macro_result . documentation =~ "An example macro"
524-
534+
525535 # Verify that specs are included in the macro documentation
526536 assert macro_result . documentation =~ "**Specs:**"
527537 assert macro_result . documentation =~ "@spec some_macro"
@@ -541,11 +551,13 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDocsAggregatorTest
541551 # Find the result with arity 2 (which has specs)
542552 func_result = Enum . find ( result . results , & ( & 1 . arity == 2 ) )
543553 assert func_result
544-
554+
545555 # Verify spec formatting
546556 assert func_result . documentation =~ "**Specs:**"
547557 assert func_result . documentation =~ "```elixir"
548- assert func_result . documentation =~ "@spec some_fun(integer(), integer() | nil) :: integer()"
558+
559+ assert func_result . documentation =~
560+ "@spec some_fun(integer(), integer() | nil) :: integer()"
549561 end
550562
551563 test "verifies macro specs are properly formatted" do
@@ -560,13 +572,51 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDocsAggregatorTest
560572 # Find the result with arity 2 (which has specs)
561573 macro_result = Enum . find ( result . results , & ( & 1 . arity == 2 ) )
562574 assert macro_result
563-
575+
564576 # Verify spec formatting for macro
565577 assert macro_result . documentation =~ "**Specs:**"
566578 assert macro_result . documentation =~ "```elixir"
567- assert macro_result . documentation =~ "@spec some_macro(Macro.t(), Macro.t() | nil) :: Macro.t()"
579+
580+ assert macro_result . documentation =~
581+ "@spec some_macro(Macro.t(), Macro.t() | nil) :: Macro.t()"
568582 end
569583
584+ test "handles builtin types with various arities" do
585+ # Test builtin type without arity - returns all matching types
586+ modules = [ "list" ]
587+ assert { :ok , result } = LlmDocsAggregator . execute ( [ modules ] , % { } )
588+ assert Map . has_key? ( result , :results )
589+ assert length ( result . results ) == 2
590+
591+ # Should get both list() and list/1
592+ list_result = Enum . find ( result . results , & ( & 1 . type == "list()" ) )
593+ assert list_result
594+ assert list_result . documentation == "A list"
595+
596+ list1_result = Enum . find ( result . results , & ( & 1 . type == "list/1" ) )
597+ assert list1_result
598+ assert list1_result . documentation == "Proper list ([]-terminated)"
599+
600+ # Test builtin type with arity 0
601+ modules = [ "list/0" ]
602+ assert { :ok , result } = LlmDocsAggregator . execute ( [ modules ] , % { } )
603+ assert Map . has_key? ( result , :results )
604+ assert length ( result . results ) == 1
605+
606+ list0_result = hd ( result . results )
607+ assert list0_result . type == "list()"
608+ assert list0_result . documentation == "A list"
609+
610+ # Test builtin type with arity 1
611+ modules = [ "list/1" ]
612+ assert { :ok , result } = LlmDocsAggregator . execute ( [ modules ] , % { } )
613+ assert Map . has_key? ( result , :results )
614+ assert length ( result . results ) == 1
615+
616+ list1_single = hd ( result . results )
617+ assert list1_single . type == "list/1"
618+ assert list1_single . documentation == "Proper list ([]-terminated)"
619+ end
570620
571621 test "returns error for invalid arguments" do
572622 # Test with non-list argument
0 commit comments