@@ -550,20 +550,39 @@ defmodule ElixirLS.Debugger.Server do
550
550
timeout = Map . get ( state . config , "debugExpressionTimeoutMs" , 10_000 )
551
551
bindings = all_variables ( state . paused_processes , args [ "frameId" ] )
552
552
553
- value = evaluate_code_expression ( expr , bindings , timeout )
553
+ result = evaluate_code_expression ( expr , bindings , timeout )
554
554
555
- child_type = Variables . child_type ( value )
556
- { state , var_id } = get_variable_reference ( child_type , state , :evaluator , value )
555
+ case result do
556
+ { :ok , value } ->
557
+ child_type = Variables . child_type ( value )
558
+ { state , var_id } = get_variable_reference ( child_type , state , :evaluator , value )
559
+
560
+ json =
561
+ % {
562
+ "result" => inspect ( value ) ,
563
+ "variablesReference" => var_id
564
+ }
565
+ |> maybe_append_children_number ( state . client_info , child_type , value )
566
+ |> maybe_append_variable_type ( state . client_info , value )
557
567
558
- json =
559
- % {
560
- "result" => inspect ( value ) ,
561
- "variablesReference" => var_id
562
- }
563
- |> maybe_append_children_number ( state . client_info , child_type , value )
564
- |> maybe_append_variable_type ( state . client_info , value )
568
+ { json , state }
565
569
566
- { json , state }
570
+ other ->
571
+ result_string =
572
+ if args [ "context" ] == "hover" do
573
+ # avoid displaying hover info when evaluation crashed
574
+ ""
575
+ else
576
+ inspect ( other )
577
+ end
578
+
579
+ json = % {
580
+ "result" => result_string ,
581
+ "variablesReference" => 0
582
+ }
583
+
584
+ { json , state }
585
+ end
567
586
end
568
587
569
588
defp handle_request ( continue_req ( _ , thread_id ) = args , state = % __MODULE__ { } ) do
@@ -739,7 +758,7 @@ defmodule ElixirLS.Debugger.Server do
739
758
result = Task . yield ( task , timeout ) || Task . shutdown ( task )
740
759
741
760
case result do
742
- { :ok , data } -> data
761
+ { :ok , data } -> { :ok , data }
743
762
nil -> :elixir_ls_expression_timeout
744
763
_otherwise -> result
745
764
end
@@ -952,6 +971,8 @@ defmodule ElixirLS.Debugger.Server do
952
971
"supportsExceptionInfoRequest" => false ,
953
972
"supportsTerminateThreadsRequest" => true ,
954
973
"supportsSingleThreadExecutionRequests" => true ,
974
+ "supportsEvaluateForHovers" => true ,
975
+ "supportsClipboardContext" => true ,
955
976
"supportTerminateDebuggee" => false
956
977
}
957
978
end
0 commit comments