# Motoko Code Formatter

**URL:** <https://forum.dfinity.org/t/motoko-code-formatter/13257>\
**Category:** Language Support\
**Tags:** Motoko\
**Created:** [May 24, 2022, 9:52am UTC](https://forum.dfinity.org/t/motoko-code-formatter/13257 "2022-05-24T09:52:51Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![0xlup3x](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/0xlup3x/32/5816_2.png) [@0xlup3x](https://forum.dfinity.org/u/0xlup3x)\
**Post date:** [May 24, 2022, 9:52am UTC](https://forum.dfinity.org/t/motoko-code-formatter/13257/1 "2022-05-24T09:52:51Z")

</div>

Hi, I was looking through available vs code extensions for Motoko but I only managed to find a formatter for imports.

How do you guys format your code, pure tabs?

---

<div class="post-metadata">

**Author:** ![inviscidpixels](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/inviscidpixels/32/9021_2.png) [@inviscidpixels](https://forum.dfinity.org/u/inviscidpixels)\
**Post date:** [May 24, 2022, 3:41pm UTC](https://forum.dfinity.org/t/motoko-code-formatter/13257/2 "2022-05-24T15:41:01Z")

</div>

Likely developing VS Code Extensions for Motoko and ICP could be the basis of an objective of a developer grant.

---

<div class="post-metadata">

**Author:** ![skilesare](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/skilesare/32/5609_2.png) [@skilesare](https://forum.dfinity.org/u/skilesare)\
**Post date:** [May 24, 2022, 4:18pm UTC](https://forum.dfinity.org/t/motoko-code-formatter/13257/3 "2022-05-24T16:18:43Z")

</div>

We already have one! [ICDevs.org - Bounty #11 Language Server Updates - $3750+](https://forum.dfinity.org/t/icdevs-org-bounty-11-language-server-updates-3750/10885)

---

<div class="post-metadata">

**Author:** ![0xlup3x](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/0xlup3x/32/5816_2.png) [@0xlup3x](https://forum.dfinity.org/u/0xlup3x)\
**Post date:** [May 26, 2022, 8:35pm UTC](https://forum.dfinity.org/t/motoko-code-formatter/13257/4 "2022-05-26T20:35:57Z")

</div>

To be honest I think the prize is pretty low taking into account the amount of work required. No one sane would code it for that bounty. It is in everyone interest that we have a code formatter in order to get more adoption, make it 10x, it’s worthy.

---

<div class="post-metadata">

**Author:** ![paulyoung](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/paulyoung/32/5251_2.png) [@paulyoung](https://forum.dfinity.org/u/paulyoung)\
**Post date:** [May 26, 2022, 8:37pm UTC](https://forum.dfinity.org/t/motoko-code-formatter/13257/5 "2022-05-26T20:37:40Z")

</div>

Having done some work towards it, I agree with that assessment.

---

<div class="post-metadata">

**Author:** ![0xlup3x](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/0xlup3x/32/5816_2.png) [@0xlup3x](https://forum.dfinity.org/u/0xlup3x)\
**Post date:** [May 26, 2022, 8:38pm UTC](https://forum.dfinity.org/t/motoko-code-formatter/13257/6 "2022-05-26T20:38:37Z")

</div>

How would you describe your progress based on the remaining work? :-s

---

<div class="post-metadata">

**Author:** ![paulyoung](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/paulyoung/32/5251_2.png) [@paulyoung](https://forum.dfinity.org/u/paulyoung)\
**Post date:** [May 26, 2022, 8:40pm UTC](https://forum.dfinity.org/t/motoko-code-formatter/13257/7 "2022-05-26T20:40:10Z")

</div>

I’m not working on it but I did some work to help get it started.

> [@Retired: ICDevs.org - Bounty #10(150ICP - 5:1 match) - Prettier Plugin](https://forum.dfinity.org/t/icdevs-org-bounty-10-150icp-5-1-match-prettier-plugin/10543/3):
>
> @paulyoung Has done a good bit of bootstrapping for this project: [Comparing dfinity:master...paulyoung:prettier · dfinity/motoko · GitHub](https://github.com/dfinity/motoko/compare/master...paulyoung:prettier) You are still going to have to do some work with comments, but this work should significantly reduce the lift on for this bounty. Thanks Paul! We also had a match come in so the bounty is up to $4,000 now.

See [`src/js/mo_prettier.ml`](https://github.com/dfinity/motoko/compare/master...paulyoung:prettier#diff-6be457cb99c6a27eae506cd0e6b8a03795879d931effbf42f3bd05cc76547cbd)

---

<div class="post-metadata">

**Author:** ![0xlup3x](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/0xlup3x/32/5816_2.png) [@0xlup3x](https://forum.dfinity.org/u/0xlup3x)\
**Post date:** [May 26, 2022, 8:44pm UTC](https://forum.dfinity.org/t/motoko-code-formatter/13257/8 "2022-05-26T20:44:34Z")

</div>

Nice, appreciate your work. Hopefully we’ll get a full timer on this one.

---

<div class="post-metadata">

**Author:** ![skilesare](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/skilesare/32/5609_2.png) [@skilesare](https://forum.dfinity.org/u/skilesare)\
**Post date:** [May 26, 2022, 8:49pm UTC](https://forum.dfinity.org/t/motoko-code-formatter/13257/9 "2022-05-26T20:49:03Z")

</div>

What is an attractive amount?

---

<div class="post-metadata">

**Author:** ![0xlup3x](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/0xlup3x/32/5816_2.png) [@0xlup3x](https://forum.dfinity.org/u/0xlup3x)\
**Post date:** [May 26, 2022, 9:08pm UTC](https://forum.dfinity.org/t/motoko-code-formatter/13257/10 "2022-05-26T21:08:17Z")

</div>

By random googling, the average senior software developer makes around 70$/hour, multiply this by x hours, I won’t give an accurate estimate myself as I barely started learning the language and writing code formatters is not something that I’ve done in the past. But I would not think that someone could do it under 200 hours. So anything under 14k imho would be just not fair and who will do it would do it out of pure passion, that could take another year or two. Idk, in most of the cases, formatters are something that come out organically from the communities and I don’t wanna emphasize the idea of just pumping money into it if there is no actual demand. But I do believe this is a big quality of life improvement that could use a bigger kickstarter.

---

<div class="post-metadata">

**Author:** ![skilesare](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/skilesare/32/5609_2.png) [@skilesare](https://forum.dfinity.org/u/skilesare)\
**Post date:** [May 27, 2022, 12:40am UTC](https://forum.dfinity.org/t/motoko-code-formatter/13257/11 "2022-05-27T00:40:06Z")

</div>

I’ve thought of breaking it into smaller chunks with significant increases across the feature set…but I need the features list and I don’t know language servers at all. Pull requests welcome. I know I want a goto declaration. 💯
