Skip to content

Commit f9dff6f

Browse files
authored
Remove unused startup queue (#141)
I don't see how startup_queue can ever be non-empty with current code. `match_trailing_spaces` is only called from our implementations of `sublime_plugin.EventListener` and those are guaranteed to exist only when `plugin_loaded` was called and where we have settings initialized already. Testing by starting sublime and switching files before plugins have loaded also proves my theory.
1 parent f4cf31e commit f9dff6f

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

trailing_spaces.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,14 @@
2828
active_views = {}
2929
current_highlight_color = None
3030
on_disk = None
31-
startup_queue = []
3231
# Highlight color as defined in settings. Plugin mutates that setting when disabled so
3332
# that has to be stored.
3433
INITIAL_HIGHLIGHT_COLOR = None
3534
settings = None
3635

3736

3837
def plugin_loaded():
39-
global settings, current_highlight_color, startup_queue, INITIAL_HIGHLIGHT_COLOR
38+
global settings, current_highlight_color, INITIAL_HIGHLIGHT_COLOR
4039

4140
# A settings layer that handled settings that included `trailing_spaces_` prefix (now deprecated).
4241
class DeprecatedSettingsDict(NamedSettingsDict):
@@ -49,11 +48,7 @@ def __getitem__(self, key):
4948
current_highlight_color = settings['highlight_color']
5049
INITIAL_HIGHLIGHT_COLOR = current_highlight_color
5150

52-
if settings['enabled']:
53-
for view in startup_queue:
54-
match_trailing_spaces(view)
55-
startup_queue = []
56-
else:
51+
if not settings['enabled']:
5752
current_highlight_color = ""
5853
if settings['highlight_color'] != current_highlight_color:
5954
settings[0].save()
@@ -63,11 +58,10 @@ def __getitem__(self, key):
6358
#
6459
# Returns nothing.
6560
def plugin_unloaded():
66-
global startup_queue, on_disk
61+
global on_disk
6762

6863
# clear all active views to kill all timeouts
6964
active_views.clear()
70-
startup_queue = []
7165
on_disk = None
7266

7367

@@ -152,10 +146,6 @@ def find_trailing_spaces(view, scan_only_visible=True):
152146
#
153147
# Returns nothing.
154148
def match_trailing_spaces(view):
155-
if not settings:
156-
startup_queue.append(view)
157-
return
158-
159149
# Silently pass ignored views.
160150
if ignore_view(view):
161151
return

0 commit comments

Comments
 (0)