Regex literal # marker font-lock override not taking effect

Đang mở
#135 5 bình luận 0 reaction 0 người được giao Xem trên GitHub

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ó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
emacs-lisp
Lĩnh vực
tooling

Hướng nghiên cứu

Bắt đầu với các quy tắc font-lock cho regex và string cùng các bài kiểm thử font-lock được đề cập trong issue. Xác nhận hành vi font-lock của tree-sitter, trong đó child capture ghi đè parent capture, sau đó triển khai tùy chọn đã chọn và thêm hoặc cập nhật một bài kiểm thử thể hiện face mong đợi cho marker #.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Emacs Lisp
Star
192
Fork
21
Merge trung bình
2 ngày 14 giờ
Pull request đã merge (30 ngày)
23

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của clojure-emacs/clojure-ts-mode

Tất cả issue của clojure-emacs/clojure-ts-mode

Issue tương tự

Thêm issue về DevTools

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.