onflow / vscode-cadence

The Visual Studio Code extension for Cadence
Apache License 2.0
55 stars 25 forks source link

Beautify Cadence #72

Open alxflw opened 2 years ago

alxflw commented 2 years ago

Issue To Be Solved

Developers could oftentimes copy and paste or write code that is not well formatted. It becomes hard to read.

(Optional): Suggest A Solution

We might be able to agree on formatting conventions for Cadence and support beautification.

turbolent commented 2 years ago

There is an issue tracking the development of a pretty printer for Cadence in the Cadence repo: onflow/cadence#209.

I have been working on an implementation in my spare and documented the status in the issue. It would be nice to finish it, it's ca 2/3 done.

Once Cadence exposes a pretty printing function, it could be exported from the Cadence language server, then used here in the Visual Studio Code, and other editors (e.g. the Playground).

jamietdavidson commented 2 years ago

Bump - is there anything I can do to help this?

turbolent commented 2 years ago

@jamietdavidson Cadence now includes a pretty-printer that is complete in the sense that it can format all code, though it does not retain comment at the moment. Once this last functionality is implemented (see https://github.com/onflow/cadence/issues/308), the pretty-printing functionality could be added to the language server, then finally used from VS Code. Help is much appreciated, the Cadence team can assist if you plan to contribute 🙌