`beginning/end-of-defun` doesn't work if point is in docstring or regex
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
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- emacs-lisp
- Lĩnh vực
- developer-experience, tooling
Hướng nghiên cứu
Bắt đầu với treesit-end-of-defun và treesit-beginning-of-defun, tái hiện vấn đề khi parser nhúng markdown-inline hoặc regex được bật và đặt point bên trong một docstring hoặc regex. Hoàn tất khi beginning/end-of-defun đi tới defun Clojure bao quanh từ các vị trí đó và CIDER có thể đánh giá các form ở đó mà không điều hướng sai.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Expected behavior
Executing C-M-e (end-of-defun) or C-M-a (beginning-of-defun) from any place inside of a defun navigates to a proper position.
Actual behavior
Point is not moved or moved to some random place inside of a docstring or a regex.
Steps to reproduce the problem
The issue is reproducible only if any of the embedded parsers is enabled (either markdown-inline or regex). When end-of-defun is called Emacs delegates its execution to treesit-end-of-defun, which tries to operate on "things", but if parser at point is not clojure it tries to navigate to the end of defun of embedded parser.
It also affects CIDER: currently it's not possible to evaluate form if point is in a docstring, because CIDER uses end-of-defun internally.
Possible solutions
We can either defun custom clojure-ts-[beginning|end]-of-defun functions and remap treesit-* versions or we can add advice before treesit-* functions to jump out of an embedded node before using an actual navigation command:
(defun clojure-ts--ensure-not-embedded (&rest args)
(when (and (derived-mode-p 'clojure-ts-mode)
(not (equal (treesit-language-at (point)) 'clojure)))
(backward-up-list 1 t)))
(advice-add 'treesit-end-of-defun :before #'clojure-ts--ensure-not-embedded)
(advice-add 'treesit-beginning-of-defun :before #'clojure--ts-ensure-not-embedded)
I tested both options locally, both work fine and solve the issue.
- 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
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của clojure-emacs/clojure-ts-mode
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
clojure-emacs/clojure-ts-mode#143 · 1 reaction ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
clojure-emacs/clojure-ts-mode#142 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
clojure-emacs/clojure-ts-mode#135 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
#_ and comment highlight differently with respect to clojure-ts-comment-macro-font-lock-bodyĐang mởbug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
clojure-emacs/clojure-ts-mode#129 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
clojure-emacs/clojure-ts-mode#117 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của clojure-emacs/clojure-ts-mode
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
py-econometrics/pyfixest#2114 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Verify the Linux Python quick start from a fresh Ubuntu checkoutCó thể đã có người làm @romanv9 đã nhận hôm nay. Đang mởdocumentation good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
R0Y00/Xbox2Windows#652 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Haseeb-MernStack/commune#138 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
clojure-emacs/cider#4235 ·
Maintainer thường phản hồi trong vòng 1 ngày