-
Notifications
You must be signed in to change notification settings - Fork 8
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
autoformat on save #30
Comments
yes! good callout. thanks @alixander |
@alixander this is actually tricker than it looks. For I think a few functions are probably required to support this :
|
Example: |
@avelino yep. I'm aware of hooks you can configure on save with a hook. I think again, the tricky part here is region support. If that's not important for most people, I'm happy to implement a quick format command on the d2-mode. Personally, I tend to use d2 mostly in regions, which is why I've held back on implementing the simple solution. Proposal here:
Are @avelino and @alixander ok with excluding region support? |
Is regions like a markdown block? I do mostly edit just the d2 files standalone. |
@alixander exactly. Regions are blocks. As an example: This is a graph
Commentary here. I mostly do graphs in regions, so for me ( personally ) unless there's region support it becomes a lot less useful. I didn't know people use standalone files frequently. Might make sense to support this for standalone files. I'll see about getting a PR started this weekend. |
Started work on a PR here: #37 |
Latest D2 version exposes a command for autoformatting D2 scripts. Intended to be used like Go's, i.e. format on save
terrastruct/d2#292
The text was updated successfully, but these errors were encountered: