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

Error when prettifying a region? #139

Open
JordanAnthonyKing opened this issue Aug 29, 2024 · 2 comments
Open

Error when prettifying a region? #139

JordanAnthonyKing opened this issue Aug 29, 2024 · 2 comments

Comments

@JordanAnthonyKing
Copy link

JordanAnthonyKing commented Aug 29, 2024

I get errors when I simply try to prettify a highlighted region. Prettifying the enter buffer works without issue:

image

@jscheid
Copy link
Owner

jscheid commented Aug 29, 2024

From our docs:

M-x prettier-prettify-region to prettify region (but note that region should align with a complete block of code).

This is somewhat misleading, we should update the docs to read "a complete top-level block of code".

That's because we're sending only the selected block to Prettier and so it thinks it's formatting a top-level construct, which yours isn't.

Admittedly that's not very useful. Perhaps it would be better to send the whole buffer up to the end of the region, have Prettier format that, then throw away any changes outside the region. I might implement that in the successor to this project which I'm working on, on and off.

@jscheid jscheid closed this as completed Sep 2, 2024
@jscheid
Copy link
Owner

jscheid commented Sep 2, 2024

Whoops, reopening as a reminder to update the docs.

@jscheid jscheid reopened this Sep 2, 2024
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

2 participants