diff options
Diffstat (limited to 'QuickLook/PreviewViewController.swift')
| -rw-r--r-- | QuickLook/PreviewViewController.swift | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/QuickLook/PreviewViewController.swift b/QuickLook/PreviewViewController.swift index ecacee0..9dbc5f2 100644 --- a/QuickLook/PreviewViewController.swift +++ b/QuickLook/PreviewViewController.swift @@ -1,10 +1,10 @@ import Cocoa import Quartz -import SwiftUI -import WmapParser import SwiftTreeSitter import SwiftTreeSitterLayer +import SwiftUI import TreeSitterWmap +import WmapParser class PreviewViewController: NSViewController, QLPreviewingController { @@ -29,7 +29,7 @@ class PreviewViewController: NSViewController, QLPreviewingController { await MainActor.run { // Clear any existing subviews and force cleanup - view.subviews.forEach { subview in + for subview in view.subviews { if let hostingView = subview as? NSHostingView<AnyView> { hostingView.rootView = AnyView(EmptyView()) } @@ -91,7 +91,7 @@ class PreviewViewController: NSViewController, QLPreviewingController { deinit { // Cleanup when view controller is deallocated - view.subviews.forEach { subview in + for subview in view.subviews { if let hostingView = subview as? NSHostingView<AnyView> { hostingView.rootView = AnyView(EmptyView()) } @@ -197,7 +197,9 @@ struct QuickLookTextEditor: NSViewRepresentable { textStorage.addAttribute(.foregroundColor, value: NSColor.textColor, range: fullRange) // Apply tree-sitter highlighting - guard let highlights = try? rootLayer.highlights(in: fullRange, provider: content.predicateTextProvider) + guard + let highlights = try? rootLayer.highlights( + in: fullRange, provider: content.predicateTextProvider) else { return } for highlight in highlights { |