Wire macOS file associations and active-window open

This commit is contained in:
h3p 2026-02-09 00:15:47 +01:00
parent 6475747725
commit 8f770883af
6 changed files with 129 additions and 5 deletions

View file

@ -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

97
Info-macOS.plist Normal file
View file

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>Neon Vision Editor</string>
<key>CFBundleName</key>
<string>Neon Vision Editor</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>NSHighResolutionCapable</key>
<true/>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>Neon Vision Editor Document</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>swift</string>
<string>py</string>
<string>pyi</string>
<string>js</string>
<string>mjs</string>
<string>cjs</string>
<string>ts</string>
<string>tsx</string>
<string>php</string>
<string>phtml</string>
<string>csv</string>
<string>tsv</string>
<string>toml</string>
<string>ini</string>
<string>yaml</string>
<string>yml</string>
<string>xml</string>
<string>sql</string>
<string>log</string>
<string>vim</string>
<string>ipynb</string>
<string>java</string>
<string>kt</string>
<string>kts</string>
<string>go</string>
<string>rb</string>
<string>rs</string>
<string>ps1</string>
<string>psm1</string>
<string>html</string>
<string>htm</string>
<string>css</string>
<string>c</string>
<string>cpp</string>
<string>cc</string>
<string>hpp</string>
<string>hh</string>
<string>h</string>
<string>m</string>
<string>mm</string>
<string>cs</string>
<string>json</string>
<string>jsonc</string>
<string>json5</string>
<string>md</string>
<string>markdown</string>
<string>sh</string>
<string>bash</string>
<string>zsh</string>
<string>cob</string>
<string>cbl</string>
<string>cobol</string>
<string>env</string>
<string>proto</string>
<string>graphql</string>
<string>gql</string>
<string>rst</string>
<string>conf</string>
<string>nginx</string>
</array>
</dict>
</array>
</dict>
</plist>

View file

@ -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";

View file

@ -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 {

View file

@ -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)

View file

@ -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"