Skip to content

RuleScript v1.6.0

Choose a tag to compare

@github-actions github-actions released this 03 Jul 14:36
· 41 commits to main since this release

RuleScript v1.6.0

RuleScript v1.6.0 focuses on source formatting and editor metadata. It adds a Core formatter, multi-line comments, region directives, and documentation comments without changing runtime behavior or adding executable language constructs.

Formatter

Use the public formatter API to normalize indentation, spacing, line endings, and block layout:

using RuleScript.Core.Formatting;

var formatted = RuleScriptFormatter.Format(source);

The formatter supports every syntax available through v1.5.0, including parallel and task, and preserves generic or dedicated block endings such as endtask and endparallel. Blank lines, line comments, multi-line comments, documentation comments, and region directives are retained. Standalone comments follow the indentation of the next syntax element, and multi-line comment content is indented beneath its delimiters.

Multi-line Comments

Scripts can use /* ... */ comments across one or more lines:

/* Load and update the player. */
var player = LoadPlayer();

Comment delimiters inside strings remain string content. An unclosed multi-line comment produces a syntax diagnostic at its opening /*.

Regions

#region and #endregion are non-executable editor directives:

#region Player
function UpdatePlayer():
    Print("update");
endfunction
#endregion

RuleScriptLanguageService.GetRegions(source) returns named, nested, one-based source ranges suitable for folding. Regions do not reach the Interpreter, Binder, or type checker.

Documentation Comments

Consecutive /// lines immediately before a function become function documentation:

/// Gets a player name.
/// @param id Player ID
/// @return Player name
function GetPlayerName(id):
    return "Player";
endfunction

Documentation is available through RuleScriptFunctionSymbol.Documentation and RuleScriptLanguageService.GetFunctionDocumentation(source, functionName). It is metadata only and does not affect execution.

Host registrations can provide the same editor metadata through RuleScriptHostFunctionOptions.Documentation or RuleScriptFunctionAttribute.Documentation. The options-based registration API also groups parameters, return type, thread-safety, and future metadata without adding more positional overload parameters.

Attribute scanning supports methods returning Task and Task<T>. A final CancellationToken parameter is injected by the Engine and is not exposed as a script argument.

Compatibility and Scope

  • Existing v1.5.0 scripts and public Lexer.Tokenize() comment-skipping behavior remain compatible.
  • No new executable keyword, flow-control construct, async primitive, lock, channel, actor, rename, code action, quick fix, syntax rewriter, or syntax walker is introduced.
  • Monaco and other editor UI integrations remain outside RuleScript.Core.

Validation

  • Debug build: 0 warnings and 0 errors.
  • Test suite: 569 passed, 0 failed, 0 skipped.