From cc7ba4669694f9b1057a4adb44fb0543ecf9d380 Mon Sep 17 00:00:00 2001 From: cxxxr Date: Thu, 28 Sep 2023 23:43:55 +0900 Subject: [PATCH] fix parsing for `(def |foo bar|` --- extensions/lisp-mode/detective.lisp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/extensions/lisp-mode/detective.lisp b/extensions/lisp-mode/detective.lisp index 22808d19d..59b276065 100644 --- a/extensions/lisp-mode/detective.lisp +++ b/extensions/lisp-mode/detective.lisp @@ -31,10 +31,9 @@ (%default-capture 'lem/detective:package-reference position)) (defmethod capture-reference ((position lem:point) (class (eql :misc-reference))) - (let* ((line (str:split #\Space (line-string position))) - (type (str:replace-all "(" "" (first line))) - (name (remove #\) (second line)))) + (ppcre:register-groups-bind (type name) + ("^\\s*\\(\\s*(\\w+)\\s+(.*)\\s*" (line-string position)) (make-instance 'lem/detective:misc-reference :misc-custom-type type - :reference-name name + :reference-name (string-right-trim '(#\space #\tab) name) :reference-point position)))