From 7ef3c4b85cad124d44f4f3809e003d2875c4de87 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sun, 17 May 2026 08:33:38 +0200 Subject: [PATCH] ILAst and IL get bracket-matching via CSharpBracketSearcher Language.BracketSearcher defaulted to DefaultBracketSearcher (no-op); only CSharpLanguage overrode it. Switching the active language to ILAst or IL left caret-on-bracket inert. Assisted-by: Claude:claude-opus-4-7:Claude Code --- ILSpy/Languages/ILAstLanguage.cs | 5 +++++ ILSpy/Languages/ILLanguage.cs | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/ILSpy/Languages/ILAstLanguage.cs b/ILSpy/Languages/ILAstLanguage.cs index 15e392094..c41d18049 100644 --- a/ILSpy/Languages/ILAstLanguage.cs +++ b/ILSpy/Languages/ILAstLanguage.cs @@ -57,6 +57,11 @@ namespace ILSpy.Languages this.name = name; } + // ILAst output uses the same `{}/()/[]` bracket conventions as C#, plus C#-style + // `//` comments and `"..."` strings. Reusing CSharpBracketSearcher gives the + // language correct bracket highlighting without a per-grammar implementation. + public override ILSpy.TextView.IBracketSearcher BracketSearcher { get; } = new CSharpBracketSearcher(); + /// /// Fires after a run installs a fresh . /// The Debug Steps pane subscribes here so it can rebind its TreeView to the new diff --git a/ILSpy/Languages/ILLanguage.cs b/ILSpy/Languages/ILLanguage.cs index 713176a04..994c12718 100644 --- a/ILSpy/Languages/ILLanguage.cs +++ b/ILSpy/Languages/ILLanguage.cs @@ -41,6 +41,10 @@ namespace ILSpy.Languages public override string FileExtension => ".il"; + // Disassembled IL uses the same `{}/()/[]` bracket conventions plus C#-style + // `//` comments and `"..."` strings — reuse CSharpBracketSearcher's logic. + public override ILSpy.TextView.IBracketSearcher BracketSearcher { get; } = new CSharpBracketSearcher(); + // DisplaySettings (ShowMetadataTokens / ShowRawRVAOffsetAndBytes / // DecodeCustomAttributeBlobs / ShowMetadataTokensInBase10) aren't wired yet — once // they are, plumb them in here. All four default to false.