diff --git a/plugin/commands/auto_set_syntax.py b/plugin/commands/auto_set_syntax.py index 1116f8a0..644fdc17 100644 --- a/plugin/commands/auto_set_syntax.py +++ b/plugin/commands/auto_set_syntax.py @@ -132,10 +132,10 @@ def _assign_syntax_for_new_view(view_snapshot: ViewSnapshot, event: ListenerEven def _assign_syntax_for_st_syntax_test(view_snapshot: ViewSnapshot, event: ListenerEvent | None = None) -> bool: if ( (view := view_snapshot.valid_view) - and (not view_snapshot.syntax or is_plaintext_syntax(view_snapshot.syntax)) + and ((view.file_name() or "").startswith("syntax_test_")) and (m := RE_ST_SYNTAX_TEST_LINE.search(view_snapshot.first_line)) - and (new_syntax := m.group("syntax")).endswith(".sublime-syntax") ): + new_syntax: str = m.group("syntax") if syntax := find_syntax_by_syntax_like(new_syntax, include_hidden=True, include_plaintext=True): return assign_syntax_to_view( view,