Wanted: Solidity formatter for Visual Studio Code

@dennison wants a Solidity formatter for Visual Studio Code.

As far as I can tell, there isn’t one yet.

We have Juan Blano’s essential Solidity extension, but this doesn’t do formatting currently. https://github.com/juanfranblanco/vscode-solidity/issues/18

Solium can do code formatting (I haven’t tried):


The other option could be to create a formatter extension:

Any suggestions on how to automagically format Solidity?


QW4K on reddit: There is a prettier for solidity plugin https://github.com/prettier-solidity/prettier-plugin-solidity

1 Like

@dennison I have asked the community on the forum, Reddit, Telegram groups, Discord. At this stage it looks like the prettier extension is the closest to a Visual Studio Code formatter extension.

The dream for “Shift+Alt+F” to format a document, or “Ctrl+K Ctrl+F” to format a selection will have to wait until we (or someone else in the community) creates a Solidity formatter extension.

1 Like

It’s actually something that I want for a long time. Same as when you star typing /** and press enter, it generates a basic comment format, like in JS. About this second one, I’ve actually discussed that with juan, but I’ve never done it. I haven’t had time to try any of this two, but it is defenetly two things that I want to have and I will try to find some time to build them.

BTW, thaks for the prettier, I didn’t knew it. So many good stuff out there.

1 Like

Worth reading https://medium.com/coinmonks/introduction-to-solidity-linting-and-formatting-e838c074791a

1 Like