diff --git a/CHANGELOG.md b/CHANGELOG.md index ea69d3c..c56e598 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,9 +10,11 @@ The format follows *Keep a Changelog*. Versions use semantic versioning with pre - Syntax highlighting for **COBOL**, **Dotenv**, **Proto**, **GraphQL**, **reStructuredText**, and **Nginx**. - Language picker/menu entries for the new languages. - Sample fixtures for manual verification of detection and highlighting. +- macOS document-type registration for supported file extensions. ### Improved - Extension and dotfile language detection for `.cob`, `.cbl`, `.cobol`, `.env*`, `.proto`, `.graphql`, `.gql`, `.rst`, and `.conf`. +- Opening files from Finder/Open With now reuses the active window when available. ## [v0.4.2-beta] - 2026-02-08 diff --git a/Info-macOS.plist b/Info-macOS.plist new file mode 100644 index 0000000..7fce2e8 --- /dev/null +++ b/Info-macOS.plist @@ -0,0 +1,97 @@ + + + + + CFBundleDisplayName + Neon Vision Editor + CFBundleName + Neon Vision Editor + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleShortVersionString + $(MARKETING_VERSION) + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + CFBundlePackageType + APPL + LSApplicationCategoryType + public.app-category.developer-tools + ITSAppUsesNonExemptEncryption + + NSHighResolutionCapable + + CFBundleDocumentTypes + + + CFBundleTypeName + Neon Vision Editor Document + CFBundleTypeRole + Editor + LSHandlerRank + Default + CFBundleTypeExtensions + + swift + py + pyi + js + mjs + cjs + ts + tsx + php + phtml + csv + tsv + toml + ini + yaml + yml + xml + sql + log + vim + ipynb + java + kt + kts + go + rb + rs + ps1 + psm1 + html + htm + css + c + cpp + cc + hpp + hh + h + m + mm + cs + json + jsonc + json5 + md + markdown + sh + bash + zsh + cob + cbl + cobol + env + proto + graphql + gql + rst + conf + nginx + + + + + diff --git a/Neon Vision Editor.xcodeproj/project.pbxproj b/Neon Vision Editor.xcodeproj/project.pbxproj index aaa2dd4..1854a1d 100644 --- a/Neon Vision Editor.xcodeproj/project.pbxproj +++ b/Neon Vision Editor.xcodeproj/project.pbxproj @@ -285,6 +285,8 @@ ENABLE_RESOURCE_ACCESS_USB = NO; ENABLE_USER_SELECTED_FILES = readwrite; GENERATE_INFOPLIST_FILE = YES; + "GENERATE_INFOPLIST_FILE[sdk=macosx*]" = NO; + "INFOPLIST_FILE[sdk=macosx*]" = "Info-macOS.plist"; INFOPLIST_KEY_CFBundleDisplayName = "Neon Vision Editor"; INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.developer-tools"; @@ -358,6 +360,8 @@ ENABLE_RESOURCE_ACCESS_USB = NO; ENABLE_USER_SELECTED_FILES = readwrite; GENERATE_INFOPLIST_FILE = YES; + "GENERATE_INFOPLIST_FILE[sdk=macosx*]" = NO; + "INFOPLIST_FILE[sdk=macosx*]" = "Info-macOS.plist"; INFOPLIST_KEY_CFBundleDisplayName = "Neon Vision Editor"; INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.developer-tools"; diff --git a/Neon Vision Editor/App/NeonVisionEditorApp.swift b/Neon Vision Editor/App/NeonVisionEditorApp.swift index f64cc0e..4eb4a1f 100644 --- a/Neon Vision Editor/App/NeonVisionEditorApp.swift +++ b/Neon Vision Editor/App/NeonVisionEditorApp.swift @@ -8,15 +8,34 @@ import AppKit #if os(macOS) final class AppDelegate: NSObject, NSApplicationDelegate { - weak var viewModel: EditorViewModel? + weak var viewModel: EditorViewModel? { + didSet { + guard let viewModel else { return } + Task { @MainActor in + self.flushPendingURLs(into: viewModel) + } + } + } + private var pendingOpenURLs: [URL] = [] func application(_ application: NSApplication, open urls: [URL]) { Task { @MainActor in - for url in urls { - self.viewModel?.openFile(url: url) + let target = WindowViewModelRegistry.shared.activeViewModel() ?? self.viewModel + if let target { + urls.forEach { target.openFile(url: $0) } + } else { + self.pendingOpenURLs.append(contentsOf: urls) } } } + + @MainActor + private func flushPendingURLs(into viewModel: EditorViewModel) { + guard !pendingOpenURLs.isEmpty else { return } + let urls = pendingOpenURLs + pendingOpenURLs.removeAll() + urls.forEach { viewModel.openFile(url: $0) } + } } private struct DetachedWindowContentView: View { diff --git a/README.md b/README.md index 6bbfed5..812b3ad 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,8 @@ If macOS blocks first launch: - Added extension and dotfile mapping for `.cob`, `.cbl`, `.cobol`, `.env*`, `.proto`, `.graphql`, `.gql`, `.rst`, and `.conf`. - Added language picker entries for the new languages across toolbar and command menus. - Added sample fixtures for manual verification of new language detection and highlighting. +- Finder/Open With now opens files in the active window when available. +- Added macOS document-type registration for supported extensions. ### v0.4.2-beta (summary) diff --git a/homebrew-tap/Casks/neon-vision-editor.rb b/homebrew-tap/Casks/neon-vision-editor.rb index 02b8438..383cf97 100644 --- a/homebrew-tap/Casks/neon-vision-editor.rb +++ b/homebrew-tap/Casks/neon-vision-editor.rb @@ -1,6 +1,6 @@ cask "neon-vision-editor" do - version "0.4.2-beta" - sha256 "aa832ffecd207ebd869ac16d61e3cd3d741eda051f2456ee5a7215e46fed8431" + version "0.4.3-beta" +sha256 "d615e4302aa5137e084ff2835badd3280cad8bfba9bb410d80b2bac99f092737" url "https://github.com/h3pdesign/Neon-Vision-Editor/releases/download/v#{version}/Neon.Vision.Editor.app.zip" name "Neon Vision Editor"