-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement format-on-save in vscode and baml-cli fmt (#1246)
This wires up Dylan's work on setting up a BAML formatter and makes it possible to auto-format _some_ BAML code: - it is now possible to format-on-save BAML code using the vscode extension by running `baml.setDefaultFormatter` as a command in vscode - `baml-cli fmt` will now work, if run in a dir containing a `baml_src` dir; it also supports dry-run (will write to stdout instead) and explicitly specifying baml files The formatter itself is... not quite there yet. So `baml-cli fmt` will stay a hidden command. - there are some syntax rules it barfs on (enums? literals? something in integ-tests) - it rewrites comments possibly too aggressively (e.g. across multiple lines they're concatenated) - unclear how useful/useless it is without the ability to format template string contents - our current grammar can be pretty brittle in some cases (e.g. newlines are not allowed in angle brackets, c.f.`"map<\nstring, string>"` is invalid)
- Loading branch information
Showing
8 changed files
with
147 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters