Skip to content

v0.10.1

Choose a tag to compare

@dsisco11 dsisco11 released this 09 Jan 03:38
· 7 commits to master since this release
b4f80e2

Release Notes — v0.11

🐛 Bug Fixes

Keyword Query Now Matches Correctly

Query.Keyword("if") now correctly matches only the "if" keyword, not all keywords in the same category. Previously, using Query.Keyword() in syntax definitions would incorrectly match any keyword from the same category due to an internal matching bug.

// Now works as expected
var schema = Schema.Create()
    .DefineKeywordCategory("ControlFlow", "if", "else", "while", "for")
    .DefineSyntax<IfStatement>("IfStatement", b => b
        .Pattern(p => p.Keyword("if").ParenBlock().BraceBlock()))
    .Build();

// Only matches "if", not "else", "while", or "for"
var ifStatements = tree.Match<IfStatement>();

Block Trivia Handling Improved

Fixed an issue where indentation after a block opener's newline was incorrectly dropped instead of being attached to the first child element. This improves round-trip fidelity when editing code with SyntaxEditor.


⚠️ Behavioral Change

If your code was unintentionally relying on Query.Keyword("x") matching multiple keywords, you'll need to update:

Old Behavior New Behavior Migration
Query.Keyword("int") matched all type keywords Matches only "int" Use Query.KeywordCategory("Types") for category matching
Worked without schema Returns empty without schema Ensure tree has schema via SyntaxTree.Parse(source, schema)

📝 Notes

  • Query.Keyword() now requires a schema to be attached to the tree
  • Schemaless trees return empty results (no exceptions thrown)
  • No changes to public API signatures