Region strings' syntax highlighting is broken when they're defined as part of another region themselves
I maintainer di solito rispondono entro 3 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 55/100
Direzione di ricerca
Riproduci il problema con ~/.config/micro/syntax/php.yaml e l’esempio di regione annidata, quindi confrontalo con la forma di espressione regolare constant.string usando lo snippet PHP fornito. Traccia il modo in cui Micro applica le regole all’interno delle regioni annidate e verifica che le stringhe mantengano i propri delimitatori e la propria precedenza fino alla chiusura della regione degli attributi che le contiene.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Go
- Stelle
- 29.8k
- Fork
- 1.4k
- Merge medio
- 1g 12h
- PR unite (30g)
- 2
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di micro-editor/micro
-
feature syntax
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
micro-editor/micro#4289 ·
I maintainer di solito rispondono entro 3 giorni
-
Also bind alt-click for multi-cursorsForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertafeature
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
micro-editor/micro#4260 ·
I maintainer di solito rispondono entro 3 giorni
-
XML syntax highlighting breaks if empty tag contains whitespace before closeForse già presa @justadityaraj l’ha presa 57 giorni fa. Apertabug syntax
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
micro-editor/micro#4213 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
micro-editor/micro#3553 · 5 commenti ·
I maintainer di solito rispondono entro 3 giorni
-
syntax
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
micro-editor/micro#2969 · 3 commenti · 1 reazione ·
I maintainer di solito rispondono entro 3 giorni
Tutte le issue di micro-editor/micro
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
[FEATURE]: Set fieldPath and reason on the CEL validation rulesForse già presa @bjosv l’ha presa oggi. Apertaenhancement needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
valkey-io/valkey-operator#618 ·
I maintainer di solito rispondono entro 3 giorni
-
agent-butler-finding bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
jordansmall/spindrift#6414 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Icinga/icinga-kubernetes#294 ·
I maintainer di solito rispondono entro 4 giorni
-
Cluster details: the Control Plane version field has a different border color than its icon boxApertakind/design sig/ui
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
kubermatic/dashboard#8449 ·
I maintainer di solito rispondono entro 1 giorno