Region strings' syntax highlighting is broken when they're defined as part of another region themselves
Maintainer thường phản hồi trong vòng 3 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 55/100
Hướng nghiên cứu
Tái hiện vấn đề với ~/.config/micro/syntax/php.yaml và ví dụ về region lồng nhau, sau đó so sánh với dạng biểu thức chính quy constant.string bằng đoạn mã PHP được cung cấp. Theo dõi cách Micro áp dụng các quy tắc bên trong các region lồng nhau và xác minh rằng các chuỗi vẫn giữ nguyên ranh giới và độ ưu tiên cho đến khi region thuộc tính bao quanh được đóng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
I was attempting to do something like the following to add syntax highlighting for PHP's attributes:
# ~/.config/micro/syntax/php.yaml
# Other rules above
- special:
start: "#\\["
end: "\\]"
rules:
- constant.string:
start: "'"
end: "'"
skip: "\\\\."
# Other rules below
When defined as a above, attributes themselves will be highlighted properly in a PHP file (when placed above the one-line comment definition), but if the attribute contains a string, the string will only be highlighted properly until it matches any other rule in the file, even if it's not defined within the string region itself, as well as the closing quotation mark. For example, in the following code:
#[SomeAttribute('A very !long string *here with /some +symbols')]
Since the exclamation mark character is defined in another, unrelated rule as an operator in the same file, Micro will only highlight the initial 'A very ! and the final ' as a string. The text in between will be highlighted as regular text, following rules defined outside of the attribute region, even before it in the file (when the colors help file states that rules further down in the file should have more priority than rules above them). So string will be highlighted as a type, and *, / and + will be highlighted as operators.
I have tried the same with other region rule definitions, and it seems to be a generalized problem for strings defined as regions within regions. Perhaps other rule definitions besides strings would suffer from this problem. It's worth testing further.
It is worth noting that changing the above YAML configuration to the following does not have this effect:
# ~/.config/micro/syntax/php.yaml
# Other rules above
- special:
start: "#\\["
end: "\\]"
rules:
- constant.string: "'.*?'"
# Other rules below
The code above doesn't present the same problem, and in this case, strings will only be overwritten based on rules defined below them as part of the same attribute region.
Environment
- Version: 2.0.13
- OS: Linux Mint 22.3
- Terminal: GNOME Terminal
- Ngôn ngữ chính
- Go
- Star
- 29.8k
- Fork
- 1.4k
- Merge trung bình
- 1 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của micro-editor/micro
-
feature syntax
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
micro-editor/micro#4289 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Also bind alt-click for multi-cursorsCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởfeature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
micro-editor/micro#4260 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
XML syntax highlighting breaks if empty tag contains whitespace before closeCó thể đã có người làm @justadityaraj đã nhận 57 ngày trước. Đang mởbug syntax
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
micro-editor/micro#4213 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
micro-editor/micro#3553 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
syntax
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
micro-editor/micro#2969 · 3 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của micro-editor/micro
Issue tương tự
-
Query cache: a failed cache page read leaves the set request's read lock held, so the scan hangsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
turbot/steampipe-plugin-sdk#986 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
router-for-me/CLIProxyAPI#7307 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
betterleaks/betterleaks#460 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
openmcp-project/service-provider-crossplane#330 ·
Maintainer thường phản hồi trong vòng 1 ngày