cider

jasalt 2025-04-03T13:59:45.604709Z

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"}

jasalt 2025-04-03T13:59:53.841199Z

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.

jasalt 2025-04-03T15:57:45.599539Z

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"}

❤️ 1
jasalt 2025-04-03T16:47:04.521139Z

Oh yeah, I think I got that working.

❤️ 1
Samuel Ludwig 2025-04-03T16:48:38.861629Z

nice! love seeing work on Phel ❤️

jasalt 2025-04-03T16:48:56.404549Z

Haha. Lisp makes PHP so much better.

Samuel Ludwig 2025-04-03T16:51:02.985649Z

agreed 🔥, i remember looking a Phel a couple years ago, but i wasnt yet confident enough to do any hacking with it

Samuel Ludwig 2025-04-03T16:51:15.822879Z

glad its still goin :^)

🤘 1
jasalt 2025-04-03T16:58:46.218229Z

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.

1