diff --git a/Configurations/NonSwiftWorkaround.xcconfig b/Configurations/NonSwiftWorkaround.xcconfig index 638c0fc..eb5edc7 100644 --- a/Configurations/NonSwiftWorkaround.xcconfig +++ b/Configurations/NonSwiftWorkaround.xcconfig @@ -4,7 +4,7 @@ OTHER_SWIFT_FLAGS = $(inherited) -Xcc -fmodule-map-file=$(GENERATED_MODULEMAP_DIR)/Internal.modulemap // SwiftTreeSitter -OTHER_SWIFT_FLAGS = $(inherited) -Xcc -fmodule-map-file=$(GENERATED_MODULEMAP_DIR)/tree-sitter.modulemap +OTHER_SWIFT_FLAGS = $(inherited) -Xcc -fmodule-map-file=$(GENERATED_MODULEMAP_DIR)/TreeSitter.modulemap // All the tree-sitter parsers OTHER_SWIFT_FLAGS = $(inherited) -Xcc -fmodule-map-file=$(GENERATED_MODULEMAP_DIR)/TreeSitterBash.modulemap diff --git a/Edit.xcodeproj/project.pbxproj b/Edit.xcodeproj/project.pbxproj index cb2ea7b..0fde976 100644 --- a/Edit.xcodeproj/project.pbxproj +++ b/Edit.xcodeproj/project.pbxproj @@ -1015,6 +1015,7 @@ C92931422B80CC6700C64DDE /* EditKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = EditKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C92931722B822BFF00C64DDE /* EditKit.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = EditKit.xcconfig; sourceTree = ""; }; C93791A32AD5E02C00665F50 /* Project-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Project-Debug.xcconfig"; sourceTree = ""; }; + C93A80492CC4052100B89FB4 /* Neon */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = Neon; path = ../Neon; sourceTree = SOURCE_ROOT; }; C93F72482BF26BDC0021ACF3 /* EditIntents.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.extensionkit-extension"; includeInIndex = 0; path = EditIntents.appex; sourceTree = BUILT_PRODUCTS_DIR; }; C93F724A2BF26BDC0021ACF3 /* EditIntentsExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditIntentsExtension.swift; sourceTree = ""; }; C93F724C2BF26BDC0021ACF3 /* HighlightIntent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HighlightIntent.swift; sourceTree = ""; }; @@ -1863,6 +1864,7 @@ C9FE52902A7525D000CACA1A = { isa = PBXGroup; children = ( + C93A80492CC4052100B89FB4 /* Neon */, C9FE538E2A76674600CACA1A /* Configurations */, C9439A742C3EC13A0020DDF5 /* Dependencies */, C9FE529B2A7525D000CACA1A /* Edit */, @@ -5336,7 +5338,7 @@ repositoryURL = "https://github.com/ChimeHQ/Neon.git"; requirement = { kind = revision; - revision = 709683a2e2f3a2e502e8383f9aa5c725bf7d85e6; + revision = 9101469ff9ae2258e88099327969c350a953407d; }; }; C93F72252BF0F9290021ACF3 /* XCRemoteSwiftPackageReference "Sparkle" */ = { diff --git a/Edit.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Edit.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 53535e8..a19e234 100644 --- a/Edit.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Edit.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "93a0f563fbf3515fa097a1cc8e611c176c645da816d19e7f63eed073d79e680a", + "originHash" : "ff7de96f98e01194f786ca218f32286d1e04cc1961dd2ec8e8d690d02ed4a344", "pins" : [ { "identity" : "asyncxpcconnection", @@ -122,14 +122,6 @@ "version" : "0.2.1" } }, - { - "identity" : "neon", - "kind" : "remoteSourceControl", - "location" : "https://github.com/ChimeHQ/Neon.git", - "state" : { - "revision" : "709683a2e2f3a2e502e8383f9aa5c725bf7d85e6" - } - }, { "identity" : "nsui", "kind" : "remoteSourceControl", @@ -221,7 +213,7 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/ChimeHQ/SwiftTreeSitter", "state" : { - "revision" : "b01904a3737649c1d8520106bbb285724fe5b0bb" + "revision" : "f01316eaf3aae07e30478f8afa76192ab4a96420" } }, { @@ -240,6 +232,15 @@ "revision" : "2ccbf37a0c7e52c7b20aadabd8e8cbbb2b25b9a8" } }, + { + "identity" : "tree-sitter", + "kind" : "remoteSourceControl", + "location" : "https://github.com/tree-sitter/tree-sitter", + "state" : { + "revision" : "d97db6d63507eb62c536bcb2c4ac7d70c8ec665e", + "version" : "0.23.2" + } + }, { "identity" : "tree-sitter-bash", "kind" : "remoteSourceControl", @@ -261,7 +262,7 @@ { "identity" : "tree-sitter-clojure", "kind" : "remoteSourceControl", - "location" : "https://github.com/mattmassicotte/tree-sitter-clojure.git", + "location" : "https://github.com/mattmassicotte/tree-sitter-clojure", "state" : { "branch" : "feature/spm", "revision" : "0a3d6ce7b48bae5e5d96af6bda9f47ec28e055bd" @@ -279,7 +280,7 @@ { "identity" : "tree-sitter-go", "kind" : "remoteSourceControl", - "location" : "https://github.com/tree-sitter/tree-sitter-go.git", + "location" : "https://github.com/tree-sitter/tree-sitter-go", "state" : { "branch" : "master", "revision" : "7ee8d928db5202f6831a78f8112fd693bf69f98b" @@ -315,7 +316,7 @@ { "identity" : "tree-sitter-markdown", "kind" : "remoteSourceControl", - "location" : "https://github.com/tree-sitter-grammars/tree-sitter-markdown.git", + "location" : "https://github.com/tree-sitter-grammars/tree-sitter-markdown", "state" : { "branch" : "split_parser", "revision" : "f9820b2db958228f9be339b67d2de874d065866e" @@ -360,7 +361,7 @@ { "identity" : "tree-sitter-swift", "kind" : "remoteSourceControl", - "location" : "https://github.com/alex-pinkus/tree-sitter-swift/", + "location" : "https://github.com/alex-pinkus/tree-sitter-swift", "state" : { "branch" : "with-generated-files", "revision" : "eda05af7ac41adb4eb19c346883c0fa32fe3bdd8" diff --git a/Edit/Modules/DocumentContent/TextMetrics.swift b/Edit/Modules/DocumentContent/TextMetrics.swift index 3ca2219..9b49c27 100644 --- a/Edit/Modules/DocumentContent/TextMetrics.swift +++ b/Edit/Modules/DocumentContent/TextMetrics.swift @@ -36,7 +36,7 @@ extension Line { @MainActor public final class TextMetrics { - public typealias ValueProvider = HybridValueProvider + public typealias ValueProvider = HybridSyncAsyncValueProvider public nonisolated static let invalidationSetKey = "set" public nonisolated static let textMetricsDidChangeNotification = Notification.Name("textMetricsDidChangeNotification") diff --git a/Edit/Modules/Highlighting/TokenServiceWrapper.swift b/Edit/Modules/Highlighting/TokenServiceWrapper.swift index 9531b3f..ac1c680 100644 --- a/Edit/Modules/Highlighting/TokenServiceWrapper.swift +++ b/Edit/Modules/Highlighting/TokenServiceWrapper.swift @@ -30,7 +30,7 @@ extension TokenServiceWrapper { public func tokens(for range: NSRange) async -> TokenApplication { guard let service else { return .init(tokens: []) } - let textMetrics = await textSystem.textMetrics.valueProvider.mainActorAsync(.location(range.max, fill: .optional)) + let textMetrics = await textSystem.textMetrics.valueProvider.async(.location(range.max, fill: .optional)) let combinedRange = CombinedTextRange(range: range, metrics: textMetrics) @@ -41,10 +41,13 @@ extension TokenServiceWrapper { } public var tokenProvider: TokenProvider { - .init( - mainActorAsyncValue: { [textSystem] range in + TokenProvider.init( + // this is needed to work around a compiler crash + // https://github.com/swiftlang/swift/issues/77123 + syncValue: { _ in nil }, + mainActorAsyncValue: { @MainActor [textSystem] range in guard let service = self.service else { return .init(tokens: []) } - let textMetrics = await textSystem.textMetrics.valueProvider.mainActorAsync(.location(range.max, fill: .optional)) + let textMetrics = await textSystem.textMetrics.valueProvider.async(.location(range.max, fill: .optional)) let combinedRange = CombinedTextRange(range: range, metrics: textMetrics) diff --git a/Edit/Modules/SyntaxService/SyntaxService.swift b/Edit/Modules/SyntaxService/SyntaxService.swift index 97d0ce4..4781c62 100644 --- a/Edit/Modules/SyntaxService/SyntaxService.swift +++ b/Edit/Modules/SyntaxService/SyntaxService.swift @@ -208,7 +208,7 @@ extension SyntaxService { do { let queryParams = try self.highlightsQueryParams(for: range) - let namedRanges = try await client.highlightsProvider.mainActorAsync(queryParams) + let namedRanges = try await client.highlightsProvider.async(queryParams) return TokenApplication(namedRanges: namedRanges, nameMap: [:], range: range) } catch {