Skip to content

Commit 576fa44

Browse files
committed
feat: add ability to customize status bar text
1 parent de7e026 commit 576fa44

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

RustEnhanced.sublime-settings

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@
5757
// If `true`, displays diagnostic messages under the cursor in the status bar.
5858
"rust_message_status_bar": false,
5959

60+
// The message to display when the syntax check is running.
61+
"rust_message_status_bar_msg": "Rust check running",
62+
63+
// A list of chars that cycle through in the status bar to indicate progress.
64+
"rust_message_status_bar_chars": [".", "..", "...", ".."],
65+
66+
// How often (ms) should the status bar text be updated when syntax checking.
67+
"rust_message_status_bar_update_delay": 200,
68+
6069
// If your cargo project has several build targets, it's possible to specify mapping of
6170
// source code filenames to the target names to enable syntax checking.
6271
// "projects": {

SyntaxCheckPlugin.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,23 @@ def run(self):
112112
def update_status(self, count=0):
113113
if self.done:
114114
return
115-
num = count % 4
116-
if num == 3:
117-
num = 1
118-
num += 1
119-
msg = 'Rust check running' + '.' * num
120-
self.window.status_message(msg)
121-
sublime.set_timeout(lambda: self.update_status(count + 1), 200)
115+
116+
status_msg = util.get_setting('rust_message_status_bar_msg')
117+
status_chars = util.get_setting('rust_message_status_bar_chars')
118+
status_update_delay = util.get_setting('rust_message_status_bar_update_delay')
119+
120+
try:
121+
status_chars_len = len(status_chars)
122+
num = count % status_chars_len
123+
if num == status_chars_len - 1:
124+
num = -1
125+
num += 1
126+
127+
self.window.status_message(status_msg + status_chars[num])
128+
sublime.set_timeout(lambda: self.update_status(count + 1), status_update_delay)
129+
except Exception as e:
130+
self.window.status_message('Error setting status text!')
131+
log.critical(self.window, "An error occurred setting status text: " + str(e))
122132

123133
def get_rustc_messages(self):
124134
"""Top-level entry point for generating messages for the given

0 commit comments

Comments
 (0)