jscheid / prettier.el

Prettier code formatting for Emacs.
GNU General Public License v3.0
172 stars 12 forks source link

Could not sync Prettier config, ...: (error "Prettier timed out after 20 seconds") #121

Closed angrybacon closed 1 year ago

angrybacon commented 1 year ago

Describe the bug

Prettier times out when sync'ing with the project configuration.

Link to M-x prettier-info output

M-x prettier-info ```lisp ;; Please create a Gist with the contents of this buffer. ;; MAKE SURE TO REMOVE ANY SENSITIVE INFORMATION FIRST (:emacs-version "GNU Emacs 30.0.50 (build 1, aarch64-apple-darwin22.4.0, NS appkit-2299.50 Version 13.3.1 (Build 22E261))\n of 2023-05-01" :prettier-el-version "1.3.0" :buffer-file-name "/Users/mathieu.marques/Workspace/doomsday-wiki/src/pages/index.tsx" :remote-id nil :major-mode tsx-ts-mode :exec-path ("~/Workspace/doomsday-wiki/node_modules/.bin" "/Users/mathieu.marques/.nvm/versions/node/v18.14.2/bin/" "/opt/homebrew/opt/coreutils/libexec/gnubin/" "/usr/local/sbin/" "/usr/local/opt/coreutils/libexec/gnubin/" "/opt/homebrew/bin/" "/opt/homebrew/sbin/" "/Users/mathieu.marques/Scripts/" "/usr/local/bin/" "/System/Cryptexes/App/usr/bin/" "/usr/bin/" "/bin/" "/usr/sbin/" "/sbin/" "/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin/" "/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin/" "/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin/" "/Users/mathieu.marques/.nvm/versions/node/v18.14.2/bin/" "/opt/homebrew/bin/" "/opt/homebrew/sbin/" "/Users/mathieu.marques/Scripts/" "/Users/mathieu.marques/Library/Android/sdk/emulator/" "/Users/mathieu.marques/Library/Android/sdk/platform-tools/" "/Users/mathieu.marques/Library/Android/sdk/emulator/" "/Users/mathieu.marques/Library/Android/sdk/platform-tools/" "/opt/homebrew/Cellar/emacs-plus@30/30.0.50/libexec/emacs/30.0.50/aarch64-apple-darwin22.4.0/") :env ("TERM=dumb" "ANDROID_HOME=/Users/mathieu.marques/Library/Android/sdk" "MANPATH=/Users/mathieu.marques/.nvm/versions/node/v18.14.2/share/man:/usr/local/opt/coreutils/libexec/gnuman:/opt/homebrew/share/man::" "XPC_FLAGS=0x0" "XPC_SERVICE_NAME=application.org.gnu.Emacs.14656331.14656336" "__CF_USER_TEXT_ENCODING=0x1F6:0x0:0x0" "TMPDIR=/var/folders/c5/n35jrw5x4c57mbg_mzgtd6680000gp/T/" "SHELL=/bin/zsh" "HOME=/Users/mathieu.marques" "SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.IAnxvfA1sg/Listeners" "LOGNAME=mathieu.marques" "PATH=/Users/mathieu.marques/.nvm/versions/node/v18.14.2/bin:/opt/homebrew/opt/coreutils/libexec/gnubin:/usr/local/sbin:/usr/local/opt/coreutils/libexec/gnubin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/mathieu.marques/Scripts:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/mathieu.marques/.nvm/versions/node/v18.14.2/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/mathieu.marques/Scripts:/Users/mathieu.marques/Library/Android/sdk/emulator:/Users/mathieu.marques/Library/Android/sdk/platform-tools:/Users/mathieu.marques/Library/Android/sdk/emulator:/Users/mathieu.marques/Library/Android/sdk/platform-tools" "__CFBundleIdentifier=org.gnu.Emacs" "COMMAND_MODE=unix2003" "USER=mathieu.marques") :prettier-options (error "Prettier timed out after 20 seconds")) ```

To Reproduce

Customizing prettier-mode-sync-config-flag prevents the error but then the buffer isn't prettified on save nor manually

Additional context

Was working until I updated my packages by deleting elpa/ then restarting Emacs. I hadn't updated since about a month or 2 I believe

jscheid commented 1 year ago

Hmm, that's no good. Could you check the *prettier (local)* buffer and see if there's anything interesting in there?

angrybacon commented 1 year ago

That's the thing, I have no such buffer and the only error I have is the one I quoted above

The issue happens both with the global mode and with the minor mode

jscheid commented 1 year ago

M-x emacs-version?

jscheid commented 1 year ago

Ah wait that's in your info already, you're running 30.

That must be it, see #120

angrybacon commented 1 year ago

Thanks I'll have a look 👍

ruderngespra commented 1 year ago

Running into the same issue, also after a package update, with emacs version 28 GNU Emacs 28.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2023-04-26

jscheid commented 1 year ago

Running into the same issue, also after a package update, with emacs version 28 GNU Emacs 28.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2023-04-26

Do you have the changed tramp code mentioned in the other ticket?

angrybacon commented 1 year ago

For posterity, I can confirm that reverting to 29 is an ok workaround. Most of what people on 30 want is already on 29

$ brew install emacs-plus@29 --with-native-comp
ruderngespra commented 1 year ago

Running into the same issue, also after a package update, with emacs version 28 GNU Emacs 28.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2023-04-26

Do you have the changed tramp code mentioned in the other ticket?

Yes, I did have it, as I noticed that I also had updated manually to the latest tramp package when I updated prettier. So there is an inconsistency between the latest tramp package and latest prettier then presumably. Removing my updated tramp and defaulting to the version which is used in built in emacs 28 fixed it, thanks a lot for all the quick help!

jscheid commented 1 year ago

@albinus are you able to shed some light on the current situation and future plans? Is this a breaking change on purpose and if so, do you have a suggestion for how we would best create compatibility with both old and new API?

albinus commented 1 year ago

@albinus are you able to shed some light on the current situation and future plans? Is this a breaking change on purpose and if so, do you have a suggestion for how we would best create compatibility with both old and new API?

tramp-accept-process-output is not a public function, it could change internally in an incompatible way. So you might contact the Tramp team on the respective mailing list in order to check what we could do with prettier.el.

jscheid commented 1 year ago

@albinus thanks for your reply. I've been subscribed to the Tramp mailing list for many years and from that I know that you are the Tramp team. Assuming that we're not going to discuss changes to Tramp in order to accommodate this package, I don't understand why we can't continue this conversation here? As far as I can tell there's really only one question that I would need answered: what is the correct way to accept output from a process that might be running remotely? Dankeschön 😄

albinus commented 1 year ago

@albinus thanks for your reply. I've been subscribed to the Tramp mailing list for many years and from that I know that you are the Tramp team.

Oh shit. This is a secret! :-)

Assuming that we're not going to discuss changes to Tramp in order to accommodate this package, I don't understand why we can't continue this conversation here? As far as I can tell there's really only one question that I would need answered: what is the correct way to accept output from a process that might be running remotely? Dankeschön smile

It is very uncomfortable to discuss and debug things here. And I dislike MS tools (github is run by MS, yes?)

I recommend to use plain accept-process-output instead of tramp-accept-process-output.

jscheid commented 1 year ago

Thanks Michael, much appreciated.

jscheid commented 1 year ago

@angrybacon @ruderngespra @amake want to give this a try? https://github.com/jscheid/prettier.el/suites/12705302516/artifacts/681968960

It's a zip file containing a tarball that you can install with M-x package-install-file. It'll hopefully work on 30 / 28 with latest tramp sources, without any additional workarounds.

amake commented 1 year ago

@jscheid Thanks, that works for me.

(Note in case others have trouble: you can M-x package-install-file the .tar or the fully expanded directory, but not the .tar.zip.)

angrybacon commented 1 year ago

@jscheid Yup, works for me too thanks a lot for taking the time to look into this