Region strings' syntax highlighting is broken when they're defined as part of another region themselves
Los mantenedores suelen responder en 3 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 55/100
Línea de trabajo
Reproduce el problema con ~/.config/micro/syntax/php.yaml y el ejemplo de región anidada; después, compáralo con la forma de expresión regular de constant.string usando el fragmento de PHP proporcionado. Rastrea cómo aplica Micro las reglas dentro de regiones anidadas y verifica que las cadenas mantengan sus límites y precedencia hasta que se cierre la región de atributos envolvente.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- Go
- Estrellas
- 29.8k
- Forks
- 1.4k
- Merge medio
- 1 d 12 h
- PR fusionados (30 d)
- 2
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de micro-editor/micro
-
feature syntax
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
micro-editor/micro#4289 ·
Los mantenedores suelen responder en 3 días
-
Also bind alt-click for multi-cursorsPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertofeature
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
micro-editor/micro#4260 ·
Los mantenedores suelen responder en 3 días
-
XML syntax highlighting breaks if empty tag contains whitespace before closePosiblemente ocupada @justadityaraj la tomó hace 58 días. Abiertobug syntax
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
micro-editor/micro#4213 · 1 comentario ·
Los mantenedores suelen responder en 3 días
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
micro-editor/micro#3553 · 5 comentarios ·
Los mantenedores suelen responder en 3 días
-
syntax
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
micro-editor/micro#2969 · 3 comentarios · 1 reacción ·
Los mantenedores suelen responder en 3 días
Todos los issues de micro-editor/micro
Issues similares
-
enhancement needs:sonnet ready-for-agent
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
microsoft/TypeScript#65370 ·
Los mantenedores suelen responder en 1 día
-
docs: data-ownership invites vendors to build add-ons around the OSPosiblemente ocupada @brandli la tomó hoy. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
gentian-org/gentian-os#894 ·
Los mantenedores suelen responder en 1 día
-
bug tech debt testing
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
aws/amazon-vpc-cni-k8s#3976 ·
Los mantenedores suelen responder en 1 día
-
bug raised-by:desk
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
medici-finance/assay#5678 ·
Los mantenedores suelen responder en 1 día