Skip to content

Migrate syntax highlighting from Highlightr to STTextView/Neon#87

Merged
RobertoMachorro merged 9 commits into
masterfrom
sttextview-support
Jul 11, 2026
Merged

Migrate syntax highlighting from Highlightr to STTextView/Neon#87
RobertoMachorro merged 9 commits into
masterfrom
sttextview-support

Conversation

@RobertoMachorro

Copy link
Copy Markdown
Owner

Summary

Replaces the Highlightr-based editor with STTextView + Neon for syntax highlighting, and modernizes several editor UI components.

  • Highlightr → STTextView conversion — swaps the highlighting engine, removing the old HighlightrCatalog, LineNumberRulerView, and SafeCodeAttributedString (the latter was a workaround for a Highlightr partial-highlight bug) in favor of LanguageCatalog and MopedTheme.
  • Background and text render fixes for the new editor.
  • Find / Find & Replace is now a floating panel.
  • Line numbers gutter fix.
  • Adds a manual integrity-testing checklist (manual-checklist.md) covering highlighting, theming, indentation, large files, and file round-tripping.

Changed files

  • TextEditorRepresentable.swift, EditorState.swift — reworked for STTextView/Neon
  • Added: LanguageCatalog.swift, MopedTheme.swift
  • Removed: HighlightrCatalog.swift, LineNumberRulerView.swift, SafeCodeAttributedString.swift
  • PreferencesView.swift, Package.resolved, project.pbxproj updated for the new dependency

Testing

See manual-checklist.md for 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

Copilot AI review requested due to automatic review settings July 11, 2026 04:05
@RobertoMachorro RobertoMachorro self-assigned this Jul 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 with STTextView + Neon plugin highlighting and new editor state management.
  • Introduces LanguageCatalog + MopedTheme and 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.

Comment thread Moped/TextEditorRepresentable.swift Outdated
Comment thread Moped/EditorState.swift
Comment thread Moped/MopedTheme.swift Outdated
Comment thread Moped.xcodeproj/project.pbxproj
RobertoMachorro and others added 3 commits July 11, 2026 00:15
- 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>
@RobertoMachorro RobertoMachorro merged commit fcf79df into master Jul 11, 2026
1 check passed
@RobertoMachorro RobertoMachorro deleted the sttextview-support branch July 11, 2026 05:06
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.

2 participants