Correct newline_limit logic

This commit is contained in:
gingerBill
2021-05-21 15:22:35 +01:00
parent f0c9f82e1b
commit 9e2eb717fe
4 changed files with 26 additions and 53 deletions
+6
View File
@@ -11,6 +11,8 @@ simplify :: proc(file: ^ast.File) {
}
format :: proc(filepath: string, source: string, config: printer.Config, parser_flags := parser.Flags{}, allocator := context.allocator) -> (string, bool) {
config := config;
pkg := ast.Package {
kind = .Normal,
};
@@ -21,6 +23,10 @@ format :: proc(filepath: string, source: string, config: printer.Config, parser_
fullpath = filepath,
};
config.newline_limit = clamp(config.newline_limit, 0, 16);
config.spaces = clamp(config.spaces, 1, 16);
config.align_length_break = clamp(config.align_length_break, 0, 64);
p := parser.default_parser(parser_flags);
ok := parser.parse_file(&p, &file);