From 148d0290ce152fb13fc5a8bc2e883ea970afa25b Mon Sep 17 00:00:00 2001 From: Matias Korhonen Date: Sat, 14 Mar 2026 22:21:05 +0200 Subject: [PATCH] Fix markdown syntax highlighting by mapping capture names The markdown tree-sitter grammar uses nvim-treesitter capture names (e.g. text.title, punctuation.special) that CaptureName.fromString() didn't recognize, causing all markdown highlights to be silently dropped. Map these to existing CaptureName cases so no new enum values or theme changes are needed. Co-Authored-By: Claude Opus 4.6 --- Sources/CodeEditSourceEditor/Enums/CaptureName.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Sources/CodeEditSourceEditor/Enums/CaptureName.swift b/Sources/CodeEditSourceEditor/Enums/CaptureName.swift index 32b37aa0d..7026a88a6 100644 --- a/Sources/CodeEditSourceEditor/Enums/CaptureName.swift +++ b/Sources/CodeEditSourceEditor/Enums/CaptureName.swift @@ -92,6 +92,18 @@ public enum CaptureName: Int8, CaseIterable, Sendable { return .keywordReturn case "keyword.function": return .keywordFunction + case "text.title", "text.strong", "punctuation.special": + return .keyword + case "text.literal", "text.uri", "string.escape": + return .string + case "text.reference": + return .type + case "text.emphasis": + return .variable + case "punctuation.delimiter": + return .comment + case "none": + return nil default: return nil }