Regex literal # marker font-lock override not taking effect

Abierto
#135 5 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 3 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
emacs-lisp
Área
tooling

Línea de trabajo

Comienza con las reglas de font-lock para regex y strings y las pruebas de font-lock mencionadas en el issue. Confirma el comportamiento de font-lock de tree-sitter cuando la captura hija sobrescribe la captura padre; después, implementa la opción seleccionada y añade o actualiza una prueba que muestre la face esperada para el marcador #.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

The regex font-lock feature defines a rule to highlight the # marker in regex literals (#"pattern") with font-lock-property-face, using :override t to override the string feature's font-lock-regexp-face that covers the entire regex_lit node. However, the override doesn't take effect -- the # gets font-lock-regexp-face like the rest of the literal.

The query itself is correct (manually running it against the tree returns the right node), so this appears to be a tree-sitter font-lock engine issue with overriding a parent-node capture from a child-node capture in a later rule.

Options:

  1. Remove the regex marker rule and let the whole #"pattern" be font-lock-regexp-face. The # is part of the regex syntax, so this is reasonable.
  2. Change the string rule to capture regex parts individually (marker, open, content, close) instead of the whole regex_lit node, avoiding the override issue entirely.
  3. Use a different face if we fix the override. font-lock-property-face is an odd choice for a reader dispatch character -- font-lock-delimiter-face would be more consistent with how #' and quote markers are handled.

I'm leaning towards option 1. Came across this while backfilling font-lock tests -- opening this so I don't forget to fix it eventually.

Lenguaje dominante
Emacs Lisp
Estrellas
192
Forks
21
Merge medio
2 d 14 h
PR fusionados (30 d)
23

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de clojure-emacs/clojure-ts-mode

Todos los issues de clojure-emacs/clojure-ts-mode

Issues similares

Más issues de DevTools

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.