MagicStack / MagicStack/MagicPython

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

Đang mở
#181 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
JavaScript
Star
1.4k
Fork
98
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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:

![](https://this.is-serious.business/2RNXNyM.png)
![](https://this.is-serious.business/VS7gT1k.png)

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

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện hai ví dụ f-string trong Sublime Text 3.2.1 với MagicPython 1.1.1 và kiểm tra các syntax scope của chúng, so sánh với ví dụ thông thường `{test:.2f}`. Được xem là hoàn tất khi các format specifier trong những trường hợp được báo cáo nhận được scope nhất quán, hoặc hành vi này được ghi lại là có chủ đích.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
tooling
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.