ITADN

Feature Request: Support for decorator semantic token type or modifier for variables used as decorators

#1783OpenFuckingSherlock 创建于 2026-04-20
language serverLSP: semantic highlightingawaiting response
F
FuckingSherlockcommented
### Description Currently, when a variable or an object attribute is used as a decorator (common in frameworks like aiogram or fastapi, e.g., @router.message()), the semantic highlighter identifies it simply as a variable or property. This causes a conflict with custom themes and TextMate rules. In many IDEs (like VS Code/Antigravity), the semantic token "variable" overrides the more specific TextMate scope entity.name.function.decorator.python. It would be great if basedpyright could provide a more specific semantic token or a modifier when an expression is part of a decorator. For example: Assign semanticTokenTypes.decorator to the expression. Or add a .decorator modifier to the variable / property token <img width="622" height="567" alt="Image" src="https://github.com/user-attachments/assets/ac3ea53c-0833-4426-8890-7e346b596cbd" /> <img width="736" height="576" alt="Image" src="https://github.com/user-attachments/assets/83c8c257-a540-44ca-a110-ba17023a8959" />
1 条评论