Skip to content

Add syntax highlighting for dispose blocks and fix test assertions - #226

Draft
Andy Jordan (andyleejordan) with Copilot wants to merge 3 commits into
mainfrom
copilot/idisposable-fix-failing-tests
Draft

Add syntax highlighting for dispose blocks and fix test assertions#226
Andy Jordan (andyleejordan) with Copilot wants to merge 3 commits into
mainfrom
copilot/idisposable-fix-failing-tests

Conversation

Copilot AI commented Aug 27, 2026

Copy link
Copy Markdown

The initial implementation for dispose block syntax highlighting failed CI due to misaligned token assertions in the test suite and an outdated compiled JSON grammar file.

Changes

  • Keyword support: Added dispose to the named block control keyword regex in PowerShellSyntax.tmLanguage, properly integrating it alongside the newly added clean block.
  • Test assertion alignment: Corrected the syntax in spec/testfiles/syntax_test_Function.ps1 by adding a space before the brace (Dispose {). This ensures the atom-grammar-test column pointers correctly align with the parsed token boundaries.
  • Grammar compilation: Regenerated the powershell.tmLanguage.json file so the tests run against the updated regex patterns.

Example

function Get-Foo {
    [CmdletBinding()]
    param()

    begin { }
    process { }
    end { }
    clean { }
    dispose { } # Now correctly highlighted as keyword.control.powershell
}

Add dispose{} named block keyword to language files.
Yay, editor highlighting!
Co-authored-by: andyleejordan <2226434+andyleejordan@users.noreply.github.com>
Co-authored-by: andyleejordan <2226434+andyleejordan@users.noreply.github.com>
Copilot AI changed the title Fix failing tests and add support for Dispose function Dispose{} dispose block (IDisposable) Add syntax highlighting for dispose blocks and fix test assertions Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants