@@ -158,7 +158,7 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDocsAggregator do
158
158
documentation: callback_info [ :documentation ] || "" ,
159
159
spec: callback_info [ :spec ] ,
160
160
kind: callback_info [ :kind ] ,
161
- metadata: callback_info [ :metadata ] || % { }
161
+ metadata: format_metadata_section ( callback_info [ :metadata ] )
162
162
}
163
163
end )
164
164
@@ -213,7 +213,7 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDocsAggregator do
213
213
% {
214
214
type: "moduledoc" ,
215
215
content: moduledoc_content ,
216
- metadata: moduledoc_metadata
216
+ metadata: format_metadata_section ( moduledoc_metadata )
217
217
}
218
218
else
219
219
nil
@@ -255,7 +255,7 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDocsAggregator do
255
255
signature: "#{ name } /#{ arity } " ,
256
256
doc: nil ,
257
257
specs: [ ] ,
258
- metadata: % { }
258
+ metadata: ""
259
259
}
260
260
end )
261
261
@@ -370,7 +370,7 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDocsAggregator do
370
370
% {
371
371
module: module_name ,
372
372
moduledoc: moduledoc_content ,
373
- moduledoc_metadata: moduledoc_metadata ,
373
+ moduledoc_metadata: format_metadata_section ( moduledoc_metadata ) ,
374
374
functions: functions_list ,
375
375
macros: macros_list ,
376
376
types: types_list ,
@@ -403,7 +403,7 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDocsAggregator do
403
403
arity: doc_arity ,
404
404
signature: "#{ function } /#{ doc_arity } " ,
405
405
doc: extract_doc ( doc ) ,
406
- metadata: metadata ,
406
+ metadata: format_metadata_section ( metadata ) ,
407
407
specs: Map . get ( specs , { name , doc_arity } , [ ] )
408
408
}
409
409
end )
@@ -439,7 +439,7 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDocsAggregator do
439
439
arity: doc_arity ,
440
440
spec: Map . get ( type_specs_by_name_arity , { name , doc_arity } ) ,
441
441
documentation: doc_content || "" ,
442
- metadata: metadata
442
+ metadata: format_metadata_section ( metadata )
443
443
}
444
444
end )
445
445
end
@@ -469,7 +469,7 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDocsAggregator do
469
469
signature: format_function_signature ( module , name , arity , metadata ) ,
470
470
doc: extract_doc ( doc ) ,
471
471
specs: [ ] ,
472
- metadata: metadata
472
+ metadata: format_metadata_section ( metadata )
473
473
}
474
474
475
475
_ ->
@@ -485,7 +485,7 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDocsAggregator do
485
485
type: Atom . to_string ( name ) ,
486
486
arity: arity ,
487
487
doc: extract_doc ( doc ) ,
488
- metadata: metadata
488
+ metadata: format_metadata_section ( metadata )
489
489
}
490
490
491
491
_ ->
@@ -501,7 +501,7 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDocsAggregator do
501
501
arity: arity ,
502
502
kind: kind ,
503
503
doc: extract_doc ( doc ) ,
504
- metadata: metadata
504
+ metadata: format_metadata_section ( metadata )
505
505
}
506
506
507
507
_ ->
@@ -549,11 +549,9 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDocsAggregator do
549
549
documentation: extract_doc ( callback_info . doc ) ,
550
550
spec: callback_info . callback ,
551
551
kind: callback_info . kind ,
552
- metadata: callback_info . metadata
552
+ metadata: format_metadata_section ( callback_info . metadata )
553
553
}
554
554
555
- callback_result = Map . put ( callback_result , :metadata , callback_info . metadata )
556
-
557
555
callback_result
558
556
end )
559
557
end
@@ -687,6 +685,10 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDocsAggregator do
687
685
|> Enum . join ( "\n " )
688
686
end
689
687
688
+ defp format_metadata_section ( metadata ) when is_binary ( metadata ) and metadata != "" do
689
+ if String . trim ( metadata ) != "" , do: metadata , else: ""
690
+ end
691
+
690
692
defp format_metadata_section ( metadata ) when is_map ( metadata ) and metadata != % { } do
691
693
metadata_md = MarkdownUtils . get_metadata_md ( metadata )
692
694
if metadata_md != "" , do: "\n \n " <> metadata_md , else: ""
0 commit comments