@@ -22,14 +22,14 @@ class MixTestSettingsCommand(sublime_plugin.WindowCommand):
22
22
def description (self ):
23
23
return 'Opens the `mix test` settings file for the current project.'
24
24
25
- def run (self , ** kwargs ):
25
+ def run (self , ** _kwargs ):
26
26
abs_file_path = self .window .active_view ().file_name ()
27
27
window_vars = self .window .extract_variables ()
28
28
mix_settings_path = reverse_find_json_path (self .window , FILE_NAMES .SETTINGS_JSON )
29
29
30
30
if mix_settings_path :
31
31
if not path .exists (mix_settings_path ):
32
- save_json_settings (mix_settings_path , add_help_info ({'args' : []}))
32
+ save_json_file (mix_settings_path , add_help_info ({'args' : []}))
33
33
sublime_NewFileFlags_NONE = 4
34
34
self .window .open_file (mix_settings_path , flags = sublime_NewFileFlags_NONE )
35
35
else :
@@ -42,14 +42,14 @@ class MixTestCommand(sublime_plugin.WindowCommand):
42
42
def description (self ):
43
43
return 'Runs the full test-suite with `mix test`.'
44
44
45
- def run (self , ** kwargs ):
45
+ def run (self , ** _kwargs ):
46
46
call_mix_test_with_settings (self .window )
47
47
48
48
class MixTestFileCommand (sublime_plugin .WindowCommand ):
49
49
def description (self ):
50
50
return 'Runs `mix test` on the current test file.'
51
51
52
- def run (self , ** kwargs ):
52
+ def run (self , ** _kwargs ):
53
53
abs_file_path = self .window .active_view ().file_name ()
54
54
assert_is_test_file (abs_file_path )
55
55
call_mix_test_with_settings (self .window , abs_file_path = abs_file_path )
@@ -156,18 +156,18 @@ class MixTestFailedCommand(sublime_plugin.WindowCommand):
156
156
def description (self ):
157
157
return 'Repeats only tests that failed the last time.'
158
158
159
- def run (self , ** kwargs ):
159
+ def run (self , ** _kwargs ):
160
160
call_mix_test_with_settings (self .window , failed = True )
161
161
162
162
class MixTestRepeatCommand (sublime_plugin .WindowCommand ):
163
163
def description (self ):
164
164
return 'Repeats `mix test` with the last used parameters.'
165
165
166
- def run (self , ** kwargs ):
166
+ def run (self , ** _kwargs ):
167
167
json_path = reverse_find_json_path (self .window , path .join ('_build' , FILE_NAMES .REPEAT_JSON ))
168
168
169
169
if json_path :
170
- call_mix_test_with_settings (self .window , ** load_json_settings (json_path ))
170
+ call_mix_test_with_settings (self .window , ** load_json_file (json_path ))
171
171
else :
172
172
print_status_msg ('Error: No tests to repeat.' )
173
173
@@ -180,7 +180,7 @@ def run(self, _edit, seed=None):
180
180
if not mix_settings_path :
181
181
return
182
182
183
- mix_params = load_json_settings (mix_settings_path )
183
+ mix_params = load_json_file (mix_settings_path )
184
184
seed = self .view .substr (self .view .sel ()[0 ]) if seed is None else seed
185
185
seed = seed .strip () if type (seed ) == str else seed
186
186
msg = None
@@ -193,7 +193,7 @@ def run(self, _edit, seed=None):
193
193
msg = 'Erased mix test seed.'
194
194
'seed' in mix_params and mix_params .pop ('seed' )
195
195
196
- save_json_settings (mix_settings_path , add_help_info (mix_params ))
196
+ save_json_file (mix_settings_path , add_help_info (mix_params ))
197
197
198
198
print_status_msg (msg or 'Error: cannot set mix test seed to: %s' % repr (seed ))
199
199
@@ -209,16 +209,16 @@ class MixTestToggleStaleFlagCommand(sublime_plugin.WindowCommand):
209
209
def description (self ):
210
210
return 'Toggles the --stale flag.'
211
211
212
- def run (self , ** kwargs ):
212
+ def run (self , ** _kwargs ):
213
213
mix_settings_path = reverse_find_json_path (self .window , FILE_NAMES .SETTINGS_JSON )
214
214
if not mix_settings_path :
215
215
return
216
- mix_params = load_json_settings (mix_settings_path )
216
+ mix_params = load_json_file (mix_settings_path )
217
217
args = mix_params .get ('args' , [])
218
218
has_stale_flag = '--stale' in args
219
219
args = [a for a in args if a != '--stale' ] if has_stale_flag else args + ['--stale' ]
220
220
mix_params ['args' ] = args
221
- save_json_settings (mix_settings_path , mix_params )
221
+ save_json_file (mix_settings_path , mix_params )
222
222
print_status_msg ('%s mix test --stale flag!' % ['Added' , 'Removed' ][has_stale_flag ])
223
223
224
224
@@ -242,6 +242,8 @@ def get_test_block_regions(view, header_region, lookup_table):
242
242
point , view_size = name_region .b , view .size ()
243
243
begin_scopes_counter = 0
244
244
245
+ # TODO: use view.expand_to_scope() when available?
246
+
245
247
while point < view_size :
246
248
token_region = view .extract_scope (point )
247
249
token_str = view .substr (token_region )
@@ -390,9 +392,9 @@ def call_mix_test_with_settings(window, **params):
390
392
params .setdefault ('file_path' , path .relpath (params ['abs_file_path' ], root_dir ))
391
393
del params ['abs_file_path' ]
392
394
393
- save_json_settings (path .join (build_dir , FILE_NAMES .REPEAT_JSON ), params )
395
+ save_json_file (path .join (build_dir , FILE_NAMES .REPEAT_JSON ), params )
394
396
395
- mix_params = load_json_settings (mix_settings_path )
397
+ mix_params = load_json_file (mix_settings_path )
396
398
mix_params = remove_help_info (mix_params )
397
399
mix_params .update (params )
398
400
mix_params .setdefault ('cwd' , root_dir )
0 commit comments