radian-software / apheleia

🌷 Run code formatter on buffer contents without moving point, using RCS patches and dynamic programming.
MIT License
558 stars 75 forks source link

Apheleia does not format with formatters installed with npm #241

Closed alternateved closed 11 months ago

alternateved commented 11 months ago

Hello!

After changes introduced in 54a192c3454e82be9d5ad910d80796b27d58035f formatters installed globally with npm do not work. I briefly tested those installed locally but they also do not seem to work anymore. Other formatters seems fine.

dschrempf commented 11 months ago

I debugged apheleia--run-formatter-process and it seems that line 935

      (when (executable-find (apheleia-formatter--arg1 ctx)

does not find apheleia-npx. I only find the lisp code of apheleia on my system but not the script. I wonder if this is a problem on my side (script is not bundled) or here.

edslocomb commented 11 months ago

hmph, all of the non-elisp files are missing...

edslocomb commented 11 months ago

I've put a PR in to melpa to include the missing scripts in the recipe:

https://github.com/melpa/melpa/pull/8809

edslocomb commented 11 months ago

...and while we wait for the gears to turn, you can clone apheleia locally and point to it in your init.el with:

(use-package apheleia :load-path "~/[your path to]/apheleia/")
alternateved commented 11 months ago

Or run M-x package-vc-install RET "https://github.com/radian-software/apheleia" (if Emacs 29) and then:

(use-package apheleia :ensure nil)
raxod502 commented 11 months ago

This is definitely an error on my part and should be fixed, but it's also worth noting that straight.el users will not run into the problem, cf https://github.com/melpa/melpa/pull/8809#issuecomment-1806961223.

alternateved commented 11 months ago

This issue is no more thanks to fix in https://github.com/melpa/melpa/pull/8809. Thanks for help @edslocomb and @raxod502!