observablehq / feedback

Customer submitted bugs and feature requests
42 stars 3 forks source link

The auto-formatter spreads large array literals over lines in a really frustrating manner #292

Open JobLeonard opened 2 years ago

JobLeonard commented 2 years ago

Sometimes I want to write down, say, an 8x8 sprite manually into an array literal. If I have the autoformatting feature enabled, which I generally like a lot, that results in silliness like this:

image

Could it instead be configured to just wrap after whatever the max column width is?

mootari commented 2 years ago

Observable uses a fork based on the outdated version 2.2.1 from almost a year ago. Prettier itself fixed this problem in version 2.3.0.

Until the Observable fork has been updated, or to keep custom line wraps, you can put the following comment before a code block (a "node") to disable auto-formatting:

// prettier-ignore

Inserting the comment at the top of a cell will effectively disable auto-formatting for the entire cell.

CobusT commented 2 years ago

I will mark this as a feature request to upgrade Prettier.