Skip to content

v0.6.3

Choose a tag to compare

@dsisco11 dsisco11 released this 01 Jan 00:36
· 30 commits to master since this release

Release Notes

Bug Fixes

Fixed: Edit method now correctly handles trivia for syntax nodes

The Edit method was incorrectly including leading trivia in the content passed to the transformer when editing syntax nodes (schema-defined nodes like function definitions, directives, etc.).

Before (broken):

// Source: "before\n@import \"file.glsl\""
tree.CreateEditor()
    .Edit(Query.Syntax<ImportNode>(), content => $"// {content}")
    .Commit();
// Result: "before// \n@import \"file.glsl\""  ❌ (newline injected in wrong place)

After (fixed):

// Source: "before\n@import \"file.glsl\""
tree.CreateEditor()
    .Edit(Query.Syntax<ImportNode>(), content => $"// {content}")
    .Commit();
// Result: "before\n// @import \"file.glsl\""  ✓ (trivia preserved correctly)

Technical details:

  • GetTrivia() now recursively extracts trivia from first/last children for container nodes
  • GetContentWithoutTrivia() now strips trivia from syntax node content before passing to transformer
  • Added regression tests for syntax node trivia handling