2
2
import sublime_plugin
3
3
import os
4
4
from .rust import (messages , rust_proc , rust_thread , util , target_detect ,
5
- cargo_settings , semver )
5
+ cargo_settings , semver , log )
6
6
from pprint import pprint
7
7
8
8
@@ -23,6 +23,7 @@ def on_post_save(self, view):
23
23
# We use phantoms which were added in 3118
24
24
if int (sublime .version ()) < 3118 :
25
25
return
26
+ log .clear_log (view .window ())
26
27
27
28
enabled = util .get_setting ('rust_syntax_checking' , True )
28
29
if enabled and util .active_view_is_rust (view = view ):
@@ -68,9 +69,11 @@ def run(self):
68
69
self .cwd = util .find_cargo_manifest (self .triggered_file_name )
69
70
if self .cwd is None :
70
71
# A manifest is required.
71
- print ('Rust Enhanced skipping on-save syntax check.' )
72
- print ('Failed to find Cargo.toml from %r' % self .triggered_file_name )
73
- print ('A Cargo.toml manifest is required.' )
72
+ log .critical (self .window , util .multiline_fix ("""
73
+ Rust Enhanced skipping on-save syntax check.
74
+ Failed to find Cargo.toml from %r
75
+ A Cargo.toml manifest is required.
76
+ """ ), self .triggered_file_name )
74
77
return
75
78
76
79
self .update_status ()
@@ -158,14 +161,10 @@ def on_begin(self, proc):
158
161
pass
159
162
160
163
def on_data (self , proc , data ):
161
- # Debugging on-save checking problems requires viewing output here,
162
- # but it is difficult to segregate useful messages (like "thread
163
- # 'main' panicked") from all the other output. Perhaps make a debug
164
- # print setting?
165
- pass
164
+ log .log (self .window , data )
166
165
167
166
def on_error (self , proc , message ):
168
- print ( 'Rust Error: %s' % message )
167
+ log . critical ( self . window , 'Rust Error: %s' , message )
169
168
170
169
def on_json (self , proc , obj ):
171
170
messages .add_rust_messages (self .window , self .msg_rel_path , obj ,
@@ -175,7 +174,7 @@ def on_json(self, proc, obj):
175
174
self .this_view_found = True
176
175
177
176
def on_finished (self , proc , rc ):
178
- pass
177
+ log . log ( self . window , 'On-save check finished.' )
179
178
180
179
def on_terminated (self , proc ):
181
- pass
180
+ log . log ( self . window , 'Process Interrupted' )
0 commit comments