@@ -86,18 +86,18 @@ def debug_server_general(args, settings):
86
86
"Specified 'debug_rootpath' does not exist or is not a directory"
87
87
)
88
88
print ('\n Testing "initialize" request:' )
89
- print (' Root = "{0 }"' .format (args .debug_rootpath ))
89
+ print (' Root = "{}"' .format (args .debug_rootpath ))
90
90
s .serve_initialize ({"params" : {"rootPath" : args .debug_rootpath }})
91
91
if len (s .post_messages ) == 0 :
92
92
print (" Successful!" )
93
93
else :
94
94
print (" Successful with errors:" )
95
95
for message in s .post_messages :
96
- print (" {0 }" .format (message [1 ]))
96
+ print (" {}" .format (message [1 ]))
97
97
# Print module directories
98
98
print ("\n Source directories:" )
99
99
for source_dir in s .source_dirs :
100
- print (" {0 }" .format (source_dir ))
100
+ print (" {}" .format (source_dir ))
101
101
#
102
102
if args .debug_diagnostics :
103
103
print ('\n Testing "textDocument/publishDiagnostics" notification:' )
@@ -117,7 +117,7 @@ def debug_server_general(args, settings):
117
117
sline = diag ["range" ]["start" ]["line" ]
118
118
message = diag ["message" ]
119
119
sev = sev_map [diag ["severity" ] - 1 ]
120
- print (' {0 :5d}:{1 } "{2 }"' .format (sline , sev , message ))
120
+ print (' {:5d}:{} "{}"' .format (sline , sev , message ))
121
121
#
122
122
if args .debug_symbols :
123
123
print ('\n Testing "textDocument/documentSymbol" request:' )
@@ -192,7 +192,7 @@ def debug_server_general(args, settings):
192
192
else :
193
193
for obj in completion_results :
194
194
print (
195
- " {0 }: {1 } -> {2 }" .format (
195
+ " {}: {} -> {}" .format (
196
196
obj ["kind" ], obj ["label" ], obj ["detail" ]
197
197
)
198
198
)
@@ -220,11 +220,11 @@ def debug_server_general(args, settings):
220
220
print (json .dumps (signature_results , indent = 2 ))
221
221
else :
222
222
active_param = signature_results .get ("activeParameter" , 0 )
223
- print (" Active param = {0 }" .format (active_param ))
223
+ print (" Active param = {}" .format (active_param ))
224
224
active_signature = signature_results .get ("activeSignature" , 0 )
225
- print (" Active sig = {0 }" .format (active_signature ))
225
+ print (" Active sig = {}" .format (active_signature ))
226
226
for i , signature in enumerate (signature_results ["signatures" ]):
227
- print (" {0 }" .format (signature ["label" ]))
227
+ print (" {}" .format (signature ["label" ]))
228
228
for j , obj in enumerate (signature ["parameters" ]):
229
229
if (i == active_signature ) and (j == active_param ):
230
230
active_mark = "*"
@@ -278,14 +278,14 @@ def debug_server_general(args, settings):
278
278
if args .debug_full_result :
279
279
print (json .dumps (definition_results , indent = 2 ))
280
280
else :
281
- print (' URI = "{0 }"' .format (definition_results ["uri" ]))
281
+ print (' URI = "{}"' .format (definition_results ["uri" ]))
282
282
print (
283
- " Line = {0 }" .format (
283
+ " Line = {}" .format (
284
284
definition_results ["range" ]["start" ]["line" ] + 1
285
285
)
286
286
)
287
287
print (
288
- " Char = {0 }" .format (
288
+ " Char = {}" .format (
289
289
definition_results ["range" ]["start" ]["character" ] + 1
290
290
)
291
291
)
@@ -345,7 +345,7 @@ def debug_server_general(args, settings):
345
345
print ("=======" )
346
346
for result in ref_results :
347
347
print (
348
- " {0 } ({1 }, {2 })" .format (
348
+ " {} ({}, {})" .format (
349
349
result ["uri" ],
350
350
result ["range" ]["start" ]["line" ] + 1 ,
351
351
result ["range" ]["start" ]["character" ] + 1 ,
@@ -379,7 +379,7 @@ def debug_server_general(args, settings):
379
379
print ("=======" )
380
380
for uri , result in ref_results ["changes" ].items ():
381
381
path = path_from_uri (uri )
382
- print ('File: "{0 }"' .format (path ))
382
+ print ('File: "{}"' .format (path ))
383
383
file_obj = s .workspace .get (path )
384
384
if file_obj is not None :
385
385
file_contents = file_obj .contents_split
@@ -388,22 +388,22 @@ def debug_server_general(args, settings):
388
388
end_line = change ["range" ]["end" ]["line" ]
389
389
start_col = change ["range" ]["start" ]["character" ]
390
390
end_col = change ["range" ]["end" ]["character" ]
391
- print (" {0 }, {1 }" .format (start_line + 1 , end_line + 1 ))
391
+ print (" {}, {}" .format (start_line + 1 , end_line + 1 ))
392
392
new_contents = []
393
393
for i in range (start_line , end_line + 1 ):
394
394
line = file_contents [i ]
395
- print (" - {0 }" .format (line ))
395
+ print (" - {}" .format (line ))
396
396
if i == start_line :
397
397
new_contents .append (
398
398
line [:start_col ] + change ["newText" ]
399
399
)
400
400
if i == end_line :
401
401
new_contents [- 1 ] += line [end_col :]
402
402
for line in new_contents :
403
- print (" + {0 }" .format (line ))
403
+ print (" + {}" .format (line ))
404
404
print ()
405
405
else :
406
- print ('Unknown file: "{0 }"' .format (path ))
406
+ print ('Unknown file: "{}"' .format (path ))
407
407
print ("=======" )
408
408
#
409
409
if args .debug_actions :
@@ -434,12 +434,10 @@ def debug_server_general(args, settings):
434
434
else :
435
435
for result in action_results :
436
436
print (
437
- "Kind = '{0}', Title = '{1}'" .format (
438
- result ["kind" ], result ["title" ]
439
- )
437
+ "Kind = '{}', Title = '{}'" .format (result ["kind" ], result ["title" ])
440
438
)
441
439
for editUri , editChange in result ["edit" ]["changes" ].items ():
442
- print ("\n Change: URI = '{0 }'" .format (editUri ))
440
+ print ("\n Change: URI = '{}'" .format (editUri ))
443
441
pp .pprint (editChange )
444
442
print ()
445
443
tmpout .close ()
@@ -485,7 +483,7 @@ def debug_server_parser(args):
485
483
print (f"Error while parsing '{ args .config } ' settings file" )
486
484
#
487
485
print ("\n Testing parser" )
488
- print (' File = "{0 }"' .format (args .debug_filepath ))
486
+ print (' File = "{}"' .format (args .debug_filepath ))
489
487
file_obj = fortran_file (args .debug_filepath , pp_suffixes )
490
488
err_str , _ = file_obj .load_from_disk ()
491
489
if err_str :
@@ -495,11 +493,11 @@ def debug_server_parser(args):
495
493
file_ast = file_obj .parse (debug = True , pp_defs = pp_defs , include_dirs = include_dirs )
496
494
print ("\n =========\n Object Tree\n =========\n " )
497
495
for obj in file_ast .get_scopes ():
498
- print ("{0 }: {1 }" .format (obj .get_type (), obj .FQSN ))
496
+ print ("{}: {}" .format (obj .get_type (), obj .FQSN ))
499
497
print_children (obj )
500
498
print ("\n =========\n Exportable Objects\n =========\n " )
501
499
for _ , obj in file_ast .global_dict .items ():
502
- print ("{0 }: {1 }" .format (obj .get_type (), obj .FQSN ))
500
+ print ("{}: {}" .format (obj .get_type (), obj .FQSN ))
503
501
504
502
505
503
def check_request_params (args , loc_needed = True ):
@@ -508,17 +506,17 @@ def check_request_params(args, loc_needed=True):
508
506
file_exists = os .path .isfile (args .debug_filepath )
509
507
if file_exists is False :
510
508
error_exit ("Specified 'debug_filepath' does not exist" )
511
- print (' File = "{0 }"' .format (args .debug_filepath ))
509
+ print (' File = "{}"' .format (args .debug_filepath ))
512
510
if loc_needed :
513
511
if args .debug_line is None :
514
512
error_exit ("'debug_line' not specified for debug request" )
515
- print (" Line = {0 }" .format (args .debug_line ))
513
+ print (" Line = {}" .format (args .debug_line ))
516
514
if args .debug_char is None :
517
515
error_exit ("'debug_char' not specified for debug request" )
518
- print (" Char = {0 }\n " .format (args .debug_char ))
516
+ print (" Char = {}\n " .format (args .debug_char ))
519
517
520
518
521
519
def print_children (obj , indent = "" ):
522
520
for child in obj .get_children ():
523
- print (" {0}{1 }: {2 }" .format (indent , child .get_type (), child .FQSN ))
521
+ print (" {}{ }: {}" .format (indent , child .get_type (), child .FQSN ))
524
522
print_children (child , indent + " " )
0 commit comments