smithy-lang / smithy-language-server

A Language Server Protocol implementation for the Smithy IDL
https://smithy.io
Apache License 2.0
33 stars 18 forks source link

Use smithy official formatter #139

Open daddykotex opened 6 months ago

daddykotex commented 6 months ago

Issue #, if available:

N/A

Description of changes:

We've implemented support for formatting via the formatter in smithy-translate but now that the official formatter is out, there is no reason not to use it.

In my own tests, the official formatter produce different results but it is more consistent. Our modeling of the AST is wrong when it comes to whitespaces and as such we produce poorly formatted files when comments are extensively used. For example, this recent issue highlight a simple snippet that is poorly formatted. The official formatter does the correct thing here.

I'd be happy to add some tests if you like this PR. Feel free to push changes to this PR if you want to do it.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.