MagicStack / MagicStack/MagicPython

Format specifiers in f-strings don't highlight the entire thing in a consistent manner

未关闭
#181 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
JavaScript
星标
1.4k
派生
98
PR 合并指标
30 天内没有已合并 PR

描述

Hello. Sometimes the :... aspect of a format string is highlighted in its entirety but often times it's not. I would like to know if it's possible to make it so it's all under the same consistent scope or if it's by design that it doesn't. My main use case has to do with types using a custom __format__.

For example:


I would have imagined both of these to fall under the same scope but they're not.

The first screenshot goes source.python > meta.fstring.python > storage.type.format.python
The second screenshot goes source.python > meta.function-call.python > meta.function-call.arguments.python > meta.fstring.python

A regular line of code without using custom __format__ (e.g. {test:.2f}) goes as source.python > meta.function-call.python > meta.function-call.arguments.python > meta.fstring.python > storage.type.format.python which is what I would expect the other two to return as well, unless it's meant to be treated differently.

  • Editor name and version: Sublime Text 3.2.1 Build 3207
  • Platform: Windows 8.1
  • Color scheme: Custom
  • MagicPython version: 1.1.1
  • A sreenshot: See above
  • 5-10 lines of surrounding code: In the screenshot hopefully

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先在使用 MagicPython 1.1.1 的 Sublime Text 3.2.1 中重现两个 f-string 示例,并检查它们的语法 scope,将其与常规的 {test:.2f} 示例进行比较。当报告案例中的格式说明符获得一致的 scope,或该行为被记录为有意设计时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
tooling
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。