Migrate syntax highlighting from Highlightr to STTextView/Neon#87
Merged
Conversation
Added a comprehensive manual checklist for testing various functionalities and features. To be done after potential breaking changes.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates Moped’s editor implementation from the Highlightr/TextKit 1 approach to STTextView (TextKit 2) with Plugin-Neon for syntax highlighting, while reworking editor-adjacent UI (notably Find/Replace) and consolidating theme/language catalogs.
Changes:
- Replaces the existing
NSTextView-based editor wiring withSTTextView+ Neon plugin highlighting and new editor state management. - Introduces
LanguageCatalog+MopedThemeand removes the Highlightr-specific catalog, ruler, and attributed-string workaround types. - Updates app/project dependencies and adds a manual verification checklist for the new editor behavior.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| Moped/TextEditorRepresentable.swift | Hosts the STTextView-based editor in SwiftUI and introduces a floating find bar panel/container integration. |
| Moped/EditorState.swift | Rebuilds editor state around STTextView + Plugin-Neon, theme/language application, gutter styling, and plain-text paste/drag behavior. |
| Moped/PreferencesView.swift | Switches Preferences UI to use the new language/theme catalogs instead of Highlightr. |
| Moped/MopedTheme.swift | Adds built-in themes and Neon theme construction bridging Moped colors to Plugin-Neon token colors. |
| Moped/LanguageCatalog.swift | Adds language registry and Neon plugin factory mapping language names to supported Neon parsers. |
| Moped.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved | Replaces Highlightr pinning with STTextView / Plugin-Neon / Neon and related dependencies. |
| Moped.xcodeproj/project.pbxproj | Removes Highlightr build refs, adds STTextView/Plugin-Neon/Neon package refs, and bumps app versioning. |
| manual-checklist.md | Adds manual QA checklist for editor highlighting, theming, indentation, large files, and round-tripping. |
| Moped/SafeCodeAttributedString.swift | Removes Highlightr-specific safety workaround attributed string. |
| Moped/LineNumberRulerView.swift | Removes custom line number ruler implementation (replaced by STTextView gutter). |
| Moped/HighlightrCatalog.swift | Removes Highlightr catalog wrapper (replaced by LanguageCatalog / MopedTheme). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Track programmatic change ID per-Coordinator instead of a shared static, so multiple open documents don't skip each other's content updates. - Invalidate the indent-style cache after a programmatic content replace (reload/force-reload) so Tab behavior uses the reloaded file's indentation. - Fix misleading MopedTheme.neonTheme doc comment (fonts follow baseFont). - Pin Neon to the full commit SHA in project.pbxproj to match Package.resolved. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace NSEqualRects(frame, .zero) with frame != .zero in AppDelegate. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Pinning Neon to the full 40-char SHA changed the requirement kind away from what Xcode had actually resolved (Package.resolved records it as branch "ce8d252"), breaking package graph resolution and causing "Missing package product 'STTextView' / 'STTextView-Plugin-Neon'". Restore the short revision that resolves and builds. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the Highlightr-based editor with STTextView + Neon for syntax highlighting, and modernizes several editor UI components.
HighlightrCatalog,LineNumberRulerView, andSafeCodeAttributedString(the latter was a workaround for a Highlightr partial-highlight bug) in favor ofLanguageCatalogandMopedTheme.manual-checklist.md) covering highlighting, theming, indentation, large files, and file round-tripping.Changed files
TextEditorRepresentable.swift,EditorState.swift— reworked for STTextView/NeonLanguageCatalog.swift,MopedTheme.swiftHighlightrCatalog.swift,LineNumberRulerView.swift,SafeCodeAttributedString.swiftPreferencesView.swift,Package.resolved,project.pbxprojupdated for the new dependencyTesting
See
manual-checklist.mdfor the manual verification steps (highlighting per language, theme/font propagation, tab/indent behavior, large files, save/reload round-trip, printing, CLI).🤖 Generated with Claude Code