v2026.6.4
All Bundles
Bundle Miscellaneous runtime utilities: UUID generation, date string parsing and formatting, command-line parameter handling, network time retrieval, and console spinner animations. Included in lang.obl.

CodeFormatter

Code formatter

Operations

Format # native

method : public : native : Format(source:String, is_color:Bool) ~ String

Parameters

NameTypeDescription
sourceStringsource code
is_colorBooltrue for ascii color formatting, false otherwise

Return

TypeDescription
Stringformatted code

Example

opts := Map->New()<String, String>;
opts->Insert("ident-space", "3");
formatter := CodeFormatter->New(opts);
src := "class Foo{method:public:Bar()~Nil{x:=1;}}";
formatter->Format(src, false)->PrintLine();

New # constructor

Constructor

New(options:Map<String,String>)

Parameters

NameTypeDescription
optionsMap<String,String>options

Support for following options:

  • "function-space" - (true|false)
  • "ident-space" - (number|0 for tabs)
  • "trim-trailing" - (true|false)
  • "start-line" - (optional|number)
  • "end-line" - (optional|number)

Example

opts := Map->New()<String, String>;
opts->Insert("ident-space", "2");
opts->Insert("trim-trailing", "true");
formatter := CodeFormatter->New(opts);