File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
apps/language_server/lib/language_server Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -453,6 +453,44 @@ defmodule ElixirLS.LanguageServer.Diagnostics do
453
453
454
454
defp build_related_information ( diagnostic , uri , source_file ) do
455
455
case diagnostic . details do
456
+ % { typing_traces: typing_traces } ->
457
+ # %{
458
+ # name: :a,
459
+ # type: :variable,
460
+ # context: nil,
461
+ # traces: [
462
+ # %{
463
+ # meta: [line: 16, column: 7],
464
+ # file: "lib/type_errors.ex",
465
+ # formatted_type: ":asd",
466
+ # formatted_expr: "a = :asd",
467
+ # formatted_hints: []
468
+ # }
469
+ # ]
470
+ # }
471
+
472
+ for typing_trace <- typing_traces , trace <- typing_trace . traces do
473
+ case typing_trace . type do
474
+ :variable ->
475
+ line = trace . meta |> Keyword . get ( :line , 1 )
476
+ column = trace . meta |> Keyword . get ( :column , 1 )
477
+
478
+ message = "given type: #{ trace . formatted_type } "
479
+
480
+ % {
481
+ "location" => % {
482
+ "uri" => uri ,
483
+ "range" =>
484
+ range (
485
+ { line , column } ,
486
+ source_file
487
+ )
488
+ } ,
489
+ "message" => message
490
+ }
491
+ end
492
+ end
493
+
456
494
# for backwards compatibility with elixir < 1.16
457
495
{ :error , % kind { } = payload } when kind == MismatchedDelimiterError ->
458
496
[
You can’t perform that action at this time.
0 commit comments