Having trouble when attempting to get class completion working with Phel as PHP namespaces have backslashes, e.g. with block character as point and completion triggered with empty prefix:
Symfony\Component\Console\█
# Cider sends:
# -> {:context "nil" :enhanced-cljs-completion? "t" :id "140" :ns "user" :op "complete" :prefix "" :session "186494"}It seems bit tricky as https://github.com/clojure-emacs/cider/blob/de548e3084f6f6b5802dd7f939fd9ddf36e62038/cider-completion.el#L184`(bounds-of-thing-at-point 'symbol)` from thingatpt.el and the lisp mode syntax table has backslash wired to quoting character, and quoting syntax highlight then fails if that is changed to be a symbol character..
Tried to override bounds-of-thing-at-point and cider-complete-at-point also but had some issues.. wondering what is best approach.
https://codeberg.org/jasalt/phel-nrepl/src/commit/99f529a629d8f289140d035c2fbd3d3c3537988f/src/util.phel#L213, not relevant to question necessarily but for extra context in case helps.
Going somewhere, hopefully not breaking stuff...
(defun phel-bounds-of-symbol-at-point ()
"Get bounds of symbol at point in Phel, including backslashes."
(save-excursion
(skip-syntax-backward "w_\\")
(let ((start (point)))
(skip-syntax-forward "w_\\")
(when (> (point) start)
(cons start (point))))))
(add-to-list 'bounds-of-thing-at-point-provider-alist
(cons 'symbol (lambda ()
(when (eq major-mode 'phel-mode)
(phel-bounds-of-symbol-at-point)))))
Now Cider sends {:context "nil" :enhanced-cljs-completion? "t" :id "6" :ns "user" :op "complete" :prefix "\\Symfony\\Component\\Console" :session "468998"}Oh yeah, I think I got that working.
nice! love seeing work on Phel ❤️
Haha. Lisp makes PHP so much better.
agreed 🔥, i remember looking a Phel a couple years ago, but i wasnt yet confident enough to do any hacking with it
glad its still goin :^)
There's some quirks but it mostly seems quite solid. I started picking it up last year to use with some WP projects. Tooling is bit behind but it's getting there :) Basilisp has been a good example also.