radian-software / apheleia

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

prettier, getting: "apheleia--formatter-context: Symbol’s value as variable is void: file" error #228

Closed raziel408 closed 9 months ago

raziel408 commented 9 months ago

I attempted to use apheleia and prettier, I installed Prettier locally, and when attempting to run apheleia-format-buffer I've got:

apheleia--formatter-context: Symbol’s value as variable is void: file

I've tried to config the apheleia-formatters variable manually but it didn't accomplished mutch. I've got an stack trace:

eval(file)
apheleia--formatter-context(prettier-javascript (npx "prettier" "--stdin-filepath" filepath "--parser=babel-flow" (apheleia-formatters-js-indent "--use-tabs" "--tab-width")) nil nil)
apheleia--run-formatter-process((npx "prettier" "--stdin-filepath" filepath "--parser=babel-flow" (apheleia-formatters-js-indent "--use-tabs" "--tab-width")) #<buffer App.js> nil #f(compiled-function (stdout) #<bytecode 0x184d8eace6a67175>) nil prettier-javascript)
apheleia--run-formatters((prettier-javascript) #<buffer App.js> nil #f(compiled-function (formatted-buffer) #<bytecode 0x2a67a22f7511694>))
apheleia-format-buffer((prettier-javascript))
funcall-interactively(apheleia-format-buffer (prettier-javascript))
raxod502 commented 9 months ago

Looks to be the same as https://github.com/radian-software/apheleia/issues/225, upgrade to latest and try again?

raziel408 commented 9 months ago

I upgraded and it started to work. Thanks for the suggestion!