@@ -166,8 +166,7 @@ defmodule ElixirLS.Debugger.Server do
166
166
0
167
167
168
168
_ ->
169
- IO . puts (
170
- :standard_error ,
169
+ Output . debugger_important (
171
170
"(Debugger) Task failed because " <> Exception . format_exit ( reason )
172
171
)
173
172
@@ -181,8 +180,7 @@ defmodule ElixirLS.Debugger.Server do
181
180
end
182
181
183
182
def handle_info ( { :DOWN , _ref , :process , pid , reason } , state = % __MODULE__ { } ) do
184
- IO . puts (
185
- :standard_error ,
183
+ Output . debugger_important (
186
184
"debugged process #{ inspect ( pid ) } exited with reason #{ Exception . format_exit ( reason ) } "
187
185
)
188
186
@@ -222,7 +220,7 @@ defmodule ElixirLS.Debugger.Server do
222
220
@ impl GenServer
223
221
def terminate ( reason , _state = % __MODULE__ { } ) do
224
222
if reason != :normal do
225
- IO . puts ( :standard_error , "(Debugger) Terminating because #{ Exception . format_exit ( reason ) } " )
223
+ Output . debugger_important ( "(Debugger) Terminating because #{ Exception . format_exit ( reason ) } " )
226
224
end
227
225
end
228
226
@@ -231,17 +229,17 @@ defmodule ElixirLS.Debugger.Server do
231
229
defp handle_request ( initialize_req ( _ , client_info ) , % __MODULE__ { client_info: nil } = state ) do
232
230
# linesStartAt1 is true by default and we only support 1-based indexing
233
231
if client_info [ "linesStartAt1" ] == false do
234
- IO . warn ( "0-based lines are not supported" )
232
+ Output . debugger_important ( "0-based lines are not supported" )
235
233
end
236
234
237
235
# columnsStartAt1 is true by default and we only support 1-based indexing
238
236
if client_info [ "columnsStartAt1" ] == false do
239
- IO . warn ( "0-based columns are not supported" )
237
+ Output . debugger_important ( "0-based columns are not supported" )
240
238
end
241
239
242
240
# pathFormat is `path` by default and we do not support other, e.g. `uri`
243
241
if client_info [ "pathFormat" ] not in [ nil , "path" ] do
244
- IO . warn ( "pathFormat #{ client_info [ "pathFormat" ] } not supported" )
242
+ Output . debugger_important ( "pathFormat #{ client_info [ "pathFormat" ] } not supported" )
245
243
end
246
244
247
245
{ capabilities ( ) , % { state | client_info: client_info } }
@@ -258,16 +256,15 @@ defmodule ElixirLS.Debugger.Server do
258
256
259
257
defp handle_request ( launch_req ( _ , config ) = args , state = % __MODULE__ { } ) do
260
258
if args [ "arguments" ] [ "noDebug" ] == true do
261
- IO . warn ( "launch with no debug is not supported" )
259
+ Output . debugger_important ( "launch with no debug is not supported" )
262
260
end
263
261
264
262
{ _ , ref } = spawn_monitor ( fn -> initialize ( config ) end )
265
263
266
264
receive do
267
265
{ :DOWN , ^ ref , :process , _pid , reason } ->
268
266
if reason != :normal do
269
- IO . puts (
270
- :standard_error ,
267
+ Output . debugger_important (
271
268
"(Debugger) Initialization failed because " <> Exception . format_exit ( reason )
272
269
)
273
270
@@ -337,7 +334,9 @@ defmodule ElixirLS.Debugger.Server do
337
334
:ok
338
335
339
336
{ :error , :function_not_found } ->
340
- IO . warn ( "Unable to delete function breakpoint on #{ inspect ( { m , f , a } ) } " )
337
+ Output . debugger_important (
338
+ "Unable to delete function breakpoint on #{ inspect ( { m , f , a } ) } "
339
+ )
341
340
end
342
341
end
343
342
@@ -735,7 +734,9 @@ defmodule ElixirLS.Debugger.Server do
735
734
catch
736
735
kind , payload ->
737
736
# when stepping out of interpreted code a MatchError is risen inside :int module (at least in OTP 23)
738
- IO . warn ( ":int.#{ action } (#{ inspect ( pid ) } ) failed: #{ Exception . format ( kind , payload ) } " )
737
+ Output . debugger_important (
738
+ ":int.#{ action } (#{ inspect ( pid ) } ) failed: #{ Exception . format ( kind , payload ) } "
739
+ )
739
740
740
741
unless action == :continue do
741
742
safe_int_action ( pid , :continue )
@@ -972,7 +973,7 @@ defmodule ElixirLS.Debugger.Server do
972
973
unless is_list ( task_args ) and "--no-compile" in task_args do
973
974
case Mix.Task . run ( "compile" , [ "--ignore-module-conflict" ] ) do
974
975
{ :error , _ } ->
975
- IO . puts ( :standard_error , "Aborting debugger due to compile errors" )
976
+ Output . debugger_important ( "Aborting debugger due to compile errors" )
976
977
:init . stop ( 1 )
977
978
978
979
_ ->
@@ -1020,7 +1021,7 @@ defmodule ElixirLS.Debugger.Server do
1020
1021
defp set_stack_trace_mode ( nil ) , do: nil
1021
1022
1022
1023
defp set_stack_trace_mode ( _ ) do
1023
- IO . warn ( ~S( stackTraceMode must be "all", "no_tail", or "false") )
1024
+ Output . debugger_important ( ~S( stackTraceMode must be "all", "no_tail", or "false") )
1024
1025
end
1025
1026
1026
1027
defp capabilities do
@@ -1150,8 +1151,7 @@ defmodule ElixirLS.Debugger.Server do
1150
1151
[ regex ]
1151
1152
1152
1153
{ :error , error } ->
1153
- IO . puts (
1154
- :standard_error ,
1154
+ Output . debugger_important (
1155
1155
"Unable to compile file pattern (#{ inspect ( pattern ) } ) into a regex. Received error: #{ inspect ( error ) } "
1156
1156
)
1157
1157
@@ -1226,7 +1226,7 @@ defmodule ElixirLS.Debugger.Server do
1226
1226
{ :module , _ } = :int . ni ( mod )
1227
1227
catch
1228
1228
_ , _ ->
1229
- IO . warn (
1229
+ Output . debugger_important (
1230
1230
"Module #{ inspect ( mod ) } cannot be interpreted. Consider adding it to `excludeModules`."
1231
1231
)
1232
1232
end
@@ -1252,7 +1252,7 @@ defmodule ElixirLS.Debugger.Server do
1252
1252
end
1253
1253
1254
1254
{ :error , reason } ->
1255
- IO . warn (
1255
+ Output . debugger_important (
1256
1256
"Unable to set condition on a breakpoint in #{ module } :#{ inspect ( lines ) } : #{ inspect ( reason ) } "
1257
1257
)
1258
1258
end
@@ -1266,7 +1266,7 @@ defmodule ElixirLS.Debugger.Server do
1266
1266
condition
1267
1267
1268
1268
{ :error , reason } ->
1269
- IO . warn ( "Cannot parse breakpoint condition: #{ inspect ( reason ) } " )
1269
+ Output . debugger_important ( "Cannot parse breakpoint condition: #{ inspect ( reason ) } " )
1270
1270
"true"
1271
1271
end
1272
1272
end
@@ -1280,12 +1280,15 @@ defmodule ElixirLS.Debugger.Server do
1280
1280
if is_integer ( term ) do
1281
1281
term
1282
1282
else
1283
- IO . warn ( "Hit condition must evaluate to integer" )
1283
+ Output . debugger_important ( "Hit condition must evaluate to integer" )
1284
1284
0
1285
1285
end
1286
1286
catch
1287
1287
kind , error ->
1288
- IO . warn ( "Error while evaluating hit condition: " <> Exception . format_banner ( kind , error ) )
1288
+ Output . debugger_important (
1289
+ "Error while evaluating hit condition: " <> Exception . format_banner ( kind , error )
1290
+ )
1291
+
1289
1292
0
1290
1293
end
1291
1294
end
0 commit comments