File tree Expand file tree Collapse file tree 1 file changed +34
-1
lines changed
Expand file tree Collapse file tree 1 file changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -29,10 +29,43 @@ module MoonScript
2929 indent_size = parse_formatter_indent_size
3030 else
3131 error! :formatter_invalid_key do
32- text " The"
32+ block do
33+ text " The"
34+ bold " formatter"
35+ text " object has an invalid key:"
36+ end
37+
38+ snippet key
39+ snippet " expected:" , snippet_data
3340 end
3441 end
3542 end
43+
44+ Formatter ::Config .new(indent_size: indent_size)
45+ rescue JSON ::ParseException
46+ error! :formatter_invalid do
47+ block do
48+ text " The"
49+ bold " formatter"
50+ text " field should be an object: "
51+ end
52+
53+ snippet snippet_data
54+ end
55+ end
56+
57+ def parse_formatter_indent_size : Int32
58+ @parser .read_int.clamp(0 , 100 ).to_i
59+ rescue JSON ::ParseException
60+ error! :formatter_indent_size_invalid do
61+ block do
62+ text " The"
63+ bold " indent-size"
64+ text " field of the formatter configuration must be a number: "
65+ end
66+
67+ snippet snippet_data
68+ end
3669 end
3770 end
3871 end
You can’t perform that action at this time.
0 commit comments