mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-04 08:51:02 +07:00
PY-72185 Use PythonHighlightingLexer instead of plain Python lexer in reparse check of PyReparseableIdentifier
The problem previously appeared in situations when an identifier was changed to a keyword, i.e. `a: Tru` -> `a: True` and `True` keyword was not highlighted properly as it was substituted by an identifier AST leaf as is bypassing the highlighting lexer Add a couple of tests on it GitOrigin-RevId: ec25d2115ec650bf781a9fe8140e8708e849ff60
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0e2764b76b
commit
c07b124c92
@@ -7,6 +7,7 @@ import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiWhiteSpace;
|
||||
import com.intellij.psi.impl.source.tree.TreeUtil;
|
||||
import com.jetbrains.python.lexer.PythonHighlightingLexer;
|
||||
import com.jetbrains.python.lexer.PythonLexer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -50,7 +51,7 @@ public class PyReparseableIdentifier extends PyReparseableTokenType {
|
||||
|
||||
|
||||
var currentLeaf = TreeUtil.findFirstLeaf(lexingContainer);
|
||||
PythonLexer lexer = new PythonLexer();
|
||||
PythonLexer lexer = new PythonHighlightingLexer(LanguageLevel.forElement(leaf.getPsi()));
|
||||
|
||||
lexer.start(updatedCharSequence);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user