add formatting shortcut to use prettier#1222
add formatting shortcut to use prettier#1222jack-arms wants to merge 3 commits intotidalcycles:mainfrom
Conversation
|
Thanks for this! Code reformatting would be a big help in furious anarchic live coding sessions.. You can run I was a bit surprised that you can't configure prettier to use inconsistent quotes, but doublechecked and you're right (although object keys can be inconsistently quoted). Will this workaround mean that lines with single quotes won't have e.g. indentation formatted? |
|
Fixed format, and yes lines with single quotes will not be formatted, (as well as surrounding lines depending on what needs to be formatted), for instance something like this: would not get formatted to: I think this is an ok tradeoff though, since things in Strudel that need single quotes are not that common from what I've seen (URLs for samples like in this example and MIDI output names come to mind, but I can't think of anything else) |
|
hey @jack-arms thank you for this PR!! |
|
@jack-arms any thoughts? i could also do the refactoring if you want |
This is for my own suggestion: #1220
This adds a shortcut to codemirror, Ctrl+, to format the document using Prettier, see this for how it's used in a standalone environment. Because Strudel uses mixed quotes and Prettier insists on consistent quotes, I had to use a hack to get around this, see comment in code.
Open to suggestions on the entrypoint for formatting!
Before format
After format