Fix repl not coloring 'lazy' after 'from'

This commit is contained in:
Stan Ulbrych 2025-12-06 18:13:57 +00:00
parent e6633ffeb8
commit 510c20081d
No known key found for this signature in database
GPG key ID: B8E58DBDB2A1A0B8
2 changed files with 2 additions and 1 deletions

View file

@ -276,7 +276,7 @@ def is_soft_keyword_used(*tokens: TI | None) -> bool:
TI(T.NAME, string=s)
):
return not keyword.iskeyword(s)
case (None | TI(T.NEWLINE) | TI(T.INDENT) | TI(T.DEDENT), TI(string="lazy"), TI(string="import")):
case (None | TI(T.NEWLINE) | TI(T.INDENT) | TI(T.DEDENT), TI(string="lazy"), TI(string="import") | TI(string="from")):
return True
case _:
return False

View file

@ -96,6 +96,7 @@ def test_gen_colors_keyword_highlighting(self):
("list", [("list", "builtin")]),
(" \n dict", [("dict", "builtin")]),
(" lazy import", [("lazy", "soft_keyword"), ("import", "keyword")]),
("lazy from cool_people import pablo", [('lazy', 'soft_keyword'), ('from', 'keyword'), ('import', 'keyword')])
]
for code, expected_highlights in cases:
with self.subTest(code=code):