Region strings' syntax highlighting is broken when they're defined as part of another region themselves
メンテナーはふだん 3 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 55/100
調査の方向性
~/.config/micro/syntax/php.yaml とネストされたリージョンの例で問題を再現し、提供された PHP スニペットを使って constant.string の正規表現形式と比較します。Micro がネストされたリージョン内でどのようにルールを適用するかを追跡し、外側の属性リージョンが閉じるまで、文字列が境界と優先順位を維持することを確認します。
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Go
- スター
- 29.8k
- フォーク
- 1.4k
- 平均マージ
- 1日 12時間
- マージ済み PR(30日)
- 2
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
micro-editor/micro のほかの issue
-
feature syntax
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
micro-editor/micro#4289 ·
メンテナーはふだん 3 日以内に返信
-
Also bind alt-click for multi-cursors対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンfeature
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
micro-editor/micro#4260 ·
メンテナーはふだん 3 日以内に返信
-
XML syntax highlighting breaks if empty tag contains whitespace before close対応中かも @justadityaraj が 57 日前に担当しました。 オープンbug syntax
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
micro-editor/micro#4213 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
micro-editor/micro#3553 · コメント 5 件 ·
メンテナーはふだん 3 日以内に返信
-
syntax
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
micro-editor/micro#2969 · コメント 3 件 · リアクション 1 件 ·
メンテナーはふだん 3 日以内に返信
micro-editor/micro の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
teradata-labs/loom#574 ·
メンテナーはふだん 1 日以内に返信
-
cli: name the CRID when saved link limits fail after publish; soften plain-republish mint warningオープンenhancement pr-polish-followup priority: low
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
layervai/qurl-integrations#1994 ·
メンテナーはふだん 1 日以内に返信
-
bug needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
CycloneDX/cyclonedx-go#304 ·
-
[Bug]: snowflake_share fails to read a share attached to a listing with target accounts ('TARGETED ACCOUNTS' in the "to" column)対応中かも @akhil9tiet が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
snowflakedb/terraform-provider-snowflake#5366 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信