diff options
| author | Ruben Beltran del Rio <jj@r.bdr.sh> | 2025-12-14 20:21:24 +0100 |
|---|---|---|
| committer | Ruben Beltran del Rio <jj@r.bdr.sh> | 2025-12-15 00:10:39 +0100 |
| commit | 0d5e6636405dbe332c33c0fb82c7ccccb20f96cb (patch) | |
| tree | a9cda2b711bbfc9277d66310440dd965b16682fc /Map/MapApp.swift | |
| parent | a5ae7aedc840a38505b3181f4e5ba92e90d94fa1 (diff) | |
Use wmap-parser-swift and tree-sitter-wmap for parsing and highlighting.
Diffstat (limited to 'Map/MapApp.swift')
| -rw-r--r-- | Map/MapApp.swift | 45 |
1 files changed, 1 insertions, 44 deletions
diff --git a/Map/MapApp.swift b/Map/MapApp.swift index b66d715..5e74049 100644 --- a/Map/MapApp.swift +++ b/Map/MapApp.swift @@ -32,7 +32,7 @@ struct MapApp: App { var body: some Scene { DocumentGroup(newDocument: MapDocument(text: nil)) { file in - MapEditor(document: file.$document, url: file.fileURL) + MapEditor(document: file.$document) .focusedSceneValue(\.document, file.$document) .focusedSceneValue(\.fileURL, file.fileURL) } @@ -65,46 +65,3 @@ struct MapApp: App { } } } - -struct LazyMapEditor: View { - @Binding var document: MapDocument - var url: URL? - - @FocusedBinding(\.document) var focusedDocument: MapDocument? - @FocusedValue(\.fileURL) var focusedFileURL: URL? - @State private var shouldRender = false - @State private var renderTask: Task<Void, Never>? - - var isActiveDocument: Bool { - guard let focusedDocument else { return false } - // Use URL for identification if available, otherwise fall back to text comparison - if let documentURL = url, - let focusedURL = focusedFileURL - { - return documentURL == focusedURL - } - // For new documents without URLs, use text comparison as fallback - return focusedDocument.text == document.text - } - - var body: some View { - if isActiveDocument { - MapEditor(document: $document, url: url) - } else { - Rectangle() - .fill(Color(NSColor.windowBackgroundColor)) - .overlay( - VStack(spacing: 16) { - Text("document.inactive") - .font(.title2) - .foregroundColor(.secondary) - if let url = url { - Text(url.lastPathComponent) - .font(.caption) - .foregroundColor(.secondary) - } - } - ) - } - } -} |