@@ -183,6 +183,15 @@ defmodule ElixirLS.Debugger.Server do
183
183
end
184
184
185
185
@ impl GenServer
186
+ def handle_call (
187
+ { :dbg , _binding , % Macro.Env { } , _stacktrace } ,
188
+ _from ,
189
+ state = % __MODULE__ { config: % { "noDebug" => true } }
190
+ ) do
191
+ # auto continue
192
+ { :reply , { :ok , false } , state }
193
+ end
194
+
186
195
def handle_call ( { :dbg , binding , % Macro.Env { } = env , stacktrace } , from , state = % __MODULE__ { } ) do
187
196
{ pid , _ref } = from
188
197
ref = Process . monitor ( pid )
@@ -532,11 +541,7 @@ defmodule ElixirLS.Debugger.Server do
532
541
{ % { } , state }
533
542
end
534
543
535
- defp handle_request ( launch_req ( _ , config ) = args , state = % __MODULE__ { } ) do
536
- if args [ "arguments" ] [ "noDebug" ] == true do
537
- Output . debugger_important ( "launch with no debug is not supported" )
538
- end
539
-
544
+ defp handle_request ( launch_req ( _ , config ) , state = % __MODULE__ { } ) do
540
545
server = self ( )
541
546
542
547
{ _ , ref } = spawn_monitor ( fn -> launch ( config , server ) end )
@@ -565,6 +570,16 @@ defmodule ElixirLS.Debugger.Server do
565
570
{ % { } , % { state | config: config } }
566
571
end
567
572
573
+ defp handle_request (
574
+ set_breakpoints_req ( _ , % { "path" => _path } , _breakpoints ) ,
575
+ % __MODULE__ { config: % { "noDebug" => true } }
576
+ ) do
577
+ raise ServerError ,
578
+ message: "invalidRequest" ,
579
+ format: "Cannot set breakpoints when running with no debug" ,
580
+ variables: % { }
581
+ end
582
+
568
583
defp handle_request (
569
584
set_breakpoints_req ( _ , % { "path" => path } , breakpoints ) ,
570
585
state = % __MODULE__ { }
@@ -604,6 +619,16 @@ defmodule ElixirLS.Debugger.Server do
604
619
{ % { "breakpoints" => breakpoints_json } , state }
605
620
end
606
621
622
+ defp handle_request (
623
+ set_function_breakpoints_req ( _ , _breakpoints ) ,
624
+ % __MODULE__ { config: % { "noDebug" => true } }
625
+ ) do
626
+ raise ServerError ,
627
+ message: "invalidRequest" ,
628
+ format: "Cannot set function breakpoints when running with no debug" ,
629
+ variables: % { }
630
+ end
631
+
607
632
defp handle_request (
608
633
set_function_breakpoints_req ( _ , breakpoints ) ,
609
634
state = % __MODULE__ { }
@@ -653,7 +678,7 @@ defmodule ElixirLS.Debugger.Server do
653
678
breaks_after = :int . all_breaks ( m )
654
679
lines = for { { ^ m , line } , _ } <- breaks_after -- breaks_before , do: line
655
680
656
- # pass nil as log_message - not supported on function breakpoints as of DAP 1.51
681
+ # pass nil as log_message - not supported on function breakpoints as of DAP 1.63
657
682
update_break_condition ( m , lines , condition , nil , hit_count )
658
683
659
684
{ :ok , lines }
@@ -706,7 +731,9 @@ defmodule ElixirLS.Debugger.Server do
706
731
end
707
732
708
733
defp handle_request ( configuration_done_req ( _ ) , state = % __MODULE__ { } ) do
709
- :int . auto_attach ( [ :break ] , build_attach_mfa ( :breakpoint_reached ) )
734
+ unless state . config [ "noDebug" ] do
735
+ :int . auto_attach ( [ :break ] , build_attach_mfa ( :breakpoint_reached ) )
736
+ end
710
737
711
738
task = state . config [ "task" ]
712
739
args = state . config [ "taskArgs" ]
@@ -742,6 +769,16 @@ defmodule ElixirLS.Debugger.Server do
742
769
{ % { } , state }
743
770
end
744
771
772
+ defp handle_request (
773
+ pause_req ( _ , _thread_id ) ,
774
+ % __MODULE__ { config: % { "noDebug" => true } }
775
+ ) do
776
+ raise ServerError ,
777
+ message: "invalidRequest" ,
778
+ format: "Cannot pause process when running with no debug" ,
779
+ variables: % { }
780
+ end
781
+
745
782
defp handle_request ( pause_req ( _ , thread_id ) , state = % __MODULE__ { } ) do
746
783
pid = state . thread_ids_to_pids [ thread_id ]
747
784
@@ -1365,7 +1402,6 @@ defmodule ElixirLS.Debugger.Server do
1365
1402
task_args = config [ "taskArgs" ] || [ ]
1366
1403
auto_interpret_files? = Map . get ( config , "debugAutoInterpretAllModules" , true )
1367
1404
1368
- set_stack_trace_mode ( config [ "stackTraceMode" ] )
1369
1405
set_env_vars ( config [ "env" ] )
1370
1406
1371
1407
File . cd! ( project_dir )
@@ -1427,14 +1463,20 @@ defmodule ElixirLS.Debugger.Server do
1427
1463
exclude_module_names
1428
1464
|> Enum . map ( & wildcard_module_name_to_pattern / 1 )
1429
1465
1430
- if auto_interpret_files? do
1431
- auto_interpret_modules ( Mix.Project . build_path ( ) , exclude_module_pattern )
1432
- end
1466
+ unless config [ "noDebug" ] do
1467
+ set_stack_trace_mode ( config [ "stackTraceMode" ] )
1433
1468
1434
- if required_files = config [ "requireFiles" ] , do: require_files ( required_files )
1469
+ if auto_interpret_files? do
1470
+ auto_interpret_modules ( Mix.Project . build_path ( ) , exclude_module_pattern )
1471
+ end
1435
1472
1436
- if interpret_modules_patterns = config [ "debugInterpretModulesPatterns" ] do
1437
- interpret_specified_modules ( interpret_modules_patterns , exclude_module_pattern )
1473
+ if required_files = config [ "requireFiles" ] , do: require_files ( required_files )
1474
+
1475
+ if interpret_modules_patterns = config [ "debugInterpretModulesPatterns" ] do
1476
+ interpret_specified_modules ( interpret_modules_patterns , exclude_module_pattern )
1477
+ end
1478
+ else
1479
+ Output . debugger_console ( "Running without debugging" )
1438
1480
end
1439
1481
1440
1482
updated_config = Map . merge ( config , % { "task" => task , "taskArgs" => task_args } )
0 commit comments