Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle cloned buffers and give error message when not visiting a file #75

Open
michaeldickens opened this issue Oct 27, 2023 · 0 comments

Comments

@michaeldickens
Copy link

michaeldickens commented Oct 27, 2023

Currently, if I run prettier-js inside a cloned buffer (created by clone-indirect-buffer), prettier-js will fail with an unhelpful error message. Looks like the issue is that it determines where to run the prettier executable by calling buffer-file-name, but buffer-file-name is nil inside cloned buffers. It would be better to either find the base file by calling (buffer-file-name (buffer-base-buffer)) or at least print a more readable error message.

Relatedly, running prettier-js inside a buffer that's not visiting a file gives an unfriendly error message. prettier-js could check whether the buffer has a file and if not, raise a descriptive error message.

I wrote a PR to try to fix this issue: #76

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant