feat: Syntax colorizer — xshd-based highlighting engine#94
Conversation
Adapt ~30 source files and 16 resource files from AvaloniaEdit commit d7a6b63 for the syntax highlighting subsystem. Key adaptations: - HighlightingBrush: replaced IBrush hierarchy with Terminal.Gui.Drawing.Color? - HighlightingColor: FontWeight/FontStyle -> bool? Bold/Italic; dropped FontFamily/FontSize - V2Loader: ParseFontWeight/ParseFontStyle return bool?; ParseColor uses TG Color - XshdColor/XmlHighlightingDefinition/SaveXshdVisitor: Bold/Italic fields - HighlightedLine: stripped WriteTo/ToHtml/ToRichTextModel (depend on Avalonia types) - DocumentHighlighter: stripped Dispatcher.UIThread.VerifyAccess() - Resources.cs: prefix changed to Terminal.Gui.Editor.Highlighting.Resources - All files: #nullable disable (upstream predates NRT) - AddRange on IList<T> replaced with foreach loops - Added XmlReaderExtensions.GetBoolAttribute (from Utils/ExtensionMethods.cs) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…gColorizer Lift AvaloniaEdit's Highlighting/ engine (~49 files) and create a HighlightingColorizer : IVisualLineTransformer that maps highlighted sections onto CellVisualLineElement attributes. Model layer (Terminal.Gui.Editor): - Highlighting/ — core types: IHighlightingDefinition, HighlightingColor, HighlightingEngine, HighlightingManager, DocumentHighlighter, HighlightingRule/RuleSet/Span, HighlightedLine/Section - Highlighting/Xshd/ — xshd loader pipeline (V1 + V2) - Highlighting/Resources/ — 14 .xshd definitions (C#, Java, JS, XML, HTML, CSS, Python, SQL, PowerShell, VB, etc.) - HighlightingBrush: IBrush → Color?; HighlightingColor: dropped FontFamily/FontSize, FontWeight → bool? Bold, FontStyle → bool? Italic View layer (Terminal.Gui.Editor): - Rendering/HighlightingColorizer.cs — IVisualLineTransformer that resolves DocumentHighlighter sections to terminal Attributes - Editor.HighlightingDefinition property replaces [Obsolete] SyntaxHighlighter/SyntaxLanguage - VisualLineBuilder: selection now applied AFTER transformers to prevent colorizer from overwriting selection attributes ted demo: - Auto-detects language by file extension via HighlightingManager - LanguageShortcut in status bar replaces TextMate theme dropdown - Removed TextMateSharp.Grammars dependency Tests: 33 new highlighting tests + updated existing tests (353 unit + 108 integration, all green). Closes #28, closes #32. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 478a120f13
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@copilot See the CR commetns and address. CI/Cd is failing too. |
Agent-Logs-Url: https://github.com/gui-cs/Editor/sessions/bd9482b2-525b-4ec7-9cf1-e018a823cda8 Co-authored-by: tig <585482+tig@users.noreply.github.com>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Addressed the review feedback and the Ubuntu CI failure in e14c37f. The fix avoids rebuilding the colorizer when nothing changed, exposes the definition’s named default highlighting color for theme background fill, and fixes the ted formatting issue that was breaking dotnet format. I also re-ran format, build, unit tests, integration tests, and validation. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot resolve the merge conflicts in this pull request |
Agent-Logs-Url: https://github.com/gui-cs/Editor/sessions/0b1fb166-d6c2-4d5d-b35f-cbaceea5d30d Co-authored-by: tig <585482+tig@users.noreply.github.com>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Co-authored-by: tig <585482+tig@users.noreply.github.com>
Agent-Logs-Url: https://github.com/gui-cs/Editor/sessions/0b1fb166-d6c2-4d5d-b35f-cbaceea5d30d Co-authored-by: tig <585482+tig@users.noreply.github.com>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Resolved the merge conflicts by merging the latest develop into this branch in da2ca99, then pushed a small follow-up cleanup in c506da1. The branch now contains develop as an ancestor and the merged tree was validated with format, build, and Ted-focused integration tests. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Summary
End-to-end syntax highlighting via AvaloniaEdit's xshd engine, replacing the [Obsolete]\ \SyntaxHighlighter/\SyntaxLanguage\ stopgap.
Model layer (\Terminal.Gui.Editor)
View layer (\Terminal.Gui.Editor)
ted demo
Tests
Closes #28, closes #32.
Per \specs/syntax-colorizer/spec.md\ and constitution R9 (end-to-end features).