MagicStack / MagicStack/MagicPython
Syntax Highlighting regex+format strings (rf)
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 1.4k
- 派生
- 98
- PR 合并指标
- 30 天内没有已合并 PR
描述
- Editor name and version: VSCode 1.75.1
- Platform: macOS
- Color scheme: Dark+ (default)
- MagicPython version: 1.1.0
- A sreenshot:

- 5-10 lines of surrounding code:
myString = "baz"
MYCONST = "qux"
myDict = {
"foo": "bar"
}
correctColoring = rf"(?=[\w]+){myString}{MYCONST}[\d]+"
incorrectDictionary = rf"(?=[\w]+){myDict['foo']}[\d]+"
regularFString = f"word{myDict['foo']}number"
This is a followup to #186. After upgrading to 1.1.0, I'm very excited that rf strings support both regex style and format string. In the attached screenshot, behold how correctly varied correctColoring is. However, any dictionary or class inside of the {} in an rf string is not colored correctly. See how myDict['foo'] varies between incorrectDictionary and regularFString. The square brackets should be purple, and 'foo' orange, but instead it is all absorbed into red.
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从这个 issue 中的 rf-string 示例开始,并将 myDict['foo'] 的高亮行为与常规 f-string 示例进行比较。检查与 issue #186 中后续工作的相关实现,在 VSCode 中复现错误的着色,并在 rf-string 格式字段中的 dictionary 或 class 表达式能够一致地高亮显示时,认为该 issue 已完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python, vscode
- 领域
- tooling
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100