diff --git a/Configurations/NonSwiftWorkaround.xcconfig b/Configurations/NonSwiftWorkaround.xcconfig index c88c248..fa893f1 100644 --- a/Configurations/NonSwiftWorkaround.xcconfig +++ b/Configurations/NonSwiftWorkaround.xcconfig @@ -1,5 +1,6 @@ // This is a workaround for a ridiculous problem related to non-Swift SPM dependencies. However, the linker will be unhappy if these modulemap files don't exist. So dependency management can get a little tricky. // - "Internal" is for TextStory // - "tree-sitter" is for SwiftTreeSitter -OTHER_SWIFT_FLAGS = $(inherited) -Xcc -fmodule-map-file=$(GENERATED_MODULEMAP_DIR)/Internal.modulemap -Xcc -fmodule-map-file=$(GENERATED_MODULEMAP_DIR)/tree-sitter.modulemap -Xcc -fmodule-map-file=$(GENERATED_MODULEMAP_DIR)/TreeSitterSwift.modulemap -Xcc -fmodule-map-file=$(GENERATED_MODULEMAP_DIR)/TreeSitterMarkdown.modulemap -Xcc -fmodule-map-file=$(GENERATED_MODULEMAP_DIR)/TreeSitterMarkdownInline.modulemap -Xcc -fmodule-map-file=$(GENERATED_MODULEMAP_DIR)/TreeSitterGo.modulemap +OTHER_SWIFT_FLAGS = $(inherited) -Xcc -fmodule-map-file=$(GENERATED_MODULEMAP_DIR)/Internal.modulemap -Xcc -fmodule-map-file=$(GENERATED_MODULEMAP_DIR)/tree-sitter.modulemap -Xcc -fmodule-map-file=$(GENERATED_MODULEMAP_DIR)/TreeSitterGo.modulemap -Xcc -fmodule-map-file=$(GENERATED_MODULEMAP_DIR)/TreeSitterMarkdown.modulemap -Xcc -fmodule-map-file=$(GENERATED_MODULEMAP_DIR)/TreeSitterMarkdownInline.modulemap -Xcc -fmodule-map-file=$(GENERATED_MODULEMAP_DIR)/TreeSitterOCaml.modulemap -Xcc -fmodule-map-file=$(GENERATED_MODULEMAP_DIR)/TreeSitterSwift.modulemap + diff --git a/Edit.xcodeproj/project.pbxproj b/Edit.xcodeproj/project.pbxproj index bcf51c1..ca56d88 100644 --- a/Edit.xcodeproj/project.pbxproj +++ b/Edit.xcodeproj/project.pbxproj @@ -160,6 +160,7 @@ C9BFA1B72BC162EF00E86487 /* NSUI in Frameworks */ = {isa = PBXBuildFile; productRef = C9BFA1B62BC162EF00E86487 /* NSUI */; }; C9CDEB552B504485009E252A /* TextSystem+SwiftTreeSitterLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9CDEB542B504485009E252A /* TextSystem+SwiftTreeSitterLayer.swift */; }; C9CDEB8F2B56ACA3009E252A /* MainOffender in Frameworks */ = {isa = PBXBuildFile; productRef = C9CDEB8E2B56ACA3009E252A /* MainOffender */; }; + C9CFCF752BF4CBE80053C9A6 /* TreeSitterOCaml in Frameworks */ = {isa = PBXBuildFile; productRef = C9CFCF742BF4CBE80053C9A6 /* TreeSitterOCaml */; }; C9DCE1502BD7BFF30067D354 /* ThemeStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DCE14F2BD7BFF30067D354 /* ThemeStore.swift */; }; C9DCE1562BD8049F0067D354 /* ObservableState.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DCE1552BD8049F0067D354 /* ObservableState.swift */; }; C9E0B9F72BD1A3CE007AF034 /* DiagnosticsStatusBarItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9E0B9F62BD1A3CE007AF034 /* DiagnosticsStatusBarItem.swift */; }; @@ -1129,6 +1130,7 @@ C96B61F32BDA70DA00561DE8 /* libEditor.a in Frameworks */, C95B91302BD98C76006FDD00 /* libDocumentContent.a in Frameworks */, C95B91232BD98B64006FDD00 /* libTextSystem.a in Frameworks */, + C9CFCF752BF4CBE80053C9A6 /* TreeSitterOCaml in Frameworks */, C95B91222BD98B4D006FDD00 /* libSyntaxService.a in Frameworks */, C96B61FD2BDA714700561DE8 /* ScrollViewPlus in Frameworks */, C95B91342BD98CA1006FDD00 /* SwiftTreeSitter in Frameworks */, @@ -2143,6 +2145,7 @@ buildRules = ( ); dependencies = ( + C9CFCF772BF4CC1E0053C9A6 /* PBXTargetDependency */, C96B62022BDA71FE00561DE8 /* PBXTargetDependency */, C96B61FB2BDA714000561DE8 /* PBXTargetDependency */, C96B61F92BDA711B00561DE8 /* PBXTargetDependency */, @@ -2177,6 +2180,7 @@ C95B913D2BD98D01006FDD00 /* SwiftTreeSitterLayer */, C96B61FC2BDA714700561DE8 /* ScrollViewPlus */, C96B62052BDA721100561DE8 /* SourceView */, + C9CFCF742BF4CBE80053C9A6 /* TreeSitterOCaml */, ); productName = EditKit; productReference = C92931422B80CC6700C64DDE /* EditKit.framework */; @@ -2364,6 +2368,7 @@ buildRules = ( ); dependencies = ( + C9CFCF792BF4CC960053C9A6 /* PBXTargetDependency */, C941F0B32B7102E80003B640 /* PBXTargetDependency */, C9CDEB912B56ACBB009E252A /* PBXTargetDependency */, C9CDEB632B51942E009E252A /* PBXTargetDependency */, @@ -2930,6 +2935,7 @@ C9BFA1AE2BC0927A00E86487 /* XCRemoteSwiftPackageReference "Glyph" */, C9E0BA3A2BD2EB05007AF034 /* XCRemoteSwiftPackageReference "ThemePark" */, C93F72252BF0F9290021ACF3 /* XCRemoteSwiftPackageReference "Sparkle" */, + C9CFCF732BF4CBE80053C9A6 /* XCRemoteSwiftPackageReference "tree-sitter-ocaml" */, ); productRefGroup = C9FE529A2A7525D000CACA1A /* Products */; projectDirPath = ""; @@ -3871,6 +3877,14 @@ isa = PBXTargetDependency; productRef = C9CDEB902B56ACBB009E252A /* MainOffender */; }; + C9CFCF772BF4CC1E0053C9A6 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + productRef = C9CFCF762BF4CC1E0053C9A6 /* TreeSitterOCaml */; + }; + C9CFCF792BF4CC960053C9A6 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + productRef = C9CFCF782BF4CC960053C9A6 /* TreeSitterOCaml */; + }; C9DCE14E2BD7BC500067D354 /* PBXTargetDependency */ = { isa = PBXTargetDependency; productRef = C9DCE14D2BD7BC500067D354 /* ThemePark */; @@ -4929,6 +4943,14 @@ minimumVersion = 0.1.0; }; }; + C9CFCF732BF4CBE80053C9A6 /* XCRemoteSwiftPackageReference "tree-sitter-ocaml" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/tree-sitter/tree-sitter-ocaml"; + requirement = { + branch = master; + kind = branch; + }; + }; C9E0BA3A2BD2EB05007AF034 /* XCRemoteSwiftPackageReference "ThemePark" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/ChimeHQ/ThemePark"; @@ -5261,6 +5283,21 @@ package = C9CDEB8D2B56ACA3009E252A /* XCRemoteSwiftPackageReference "MainOffender" */; productName = MainOffender; }; + C9CFCF742BF4CBE80053C9A6 /* TreeSitterOCaml */ = { + isa = XCSwiftPackageProductDependency; + package = C9CFCF732BF4CBE80053C9A6 /* XCRemoteSwiftPackageReference "tree-sitter-ocaml" */; + productName = TreeSitterOCaml; + }; + C9CFCF762BF4CC1E0053C9A6 /* TreeSitterOCaml */ = { + isa = XCSwiftPackageProductDependency; + package = C9CFCF732BF4CBE80053C9A6 /* XCRemoteSwiftPackageReference "tree-sitter-ocaml" */; + productName = TreeSitterOCaml; + }; + C9CFCF782BF4CC960053C9A6 /* TreeSitterOCaml */ = { + isa = XCSwiftPackageProductDependency; + package = C9CFCF732BF4CBE80053C9A6 /* XCRemoteSwiftPackageReference "tree-sitter-ocaml" */; + productName = TreeSitterOCaml; + }; C9DCE14D2BD7BC500067D354 /* ThemePark */ = { isa = XCSwiftPackageProductDependency; package = C9E0BA3A2BD2EB05007AF034 /* XCRemoteSwiftPackageReference "ThemePark" */; diff --git a/Edit.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Edit.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index f507c9a..86f843a 100644 --- a/Edit.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Edit.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "78a8897458ae353ab1f4fd14e2c55be0dba3fe7c46fb08bf337134a46b1e4ea1", + "originHash" : "5a57c719e79b0a39e32c853b3d8e18f925cbf132ebb27828399c403312eb262e", "pins" : [ { "identity" : "asyncxpcconnection", @@ -258,6 +258,15 @@ "revision" : "f9820b2db958228f9be339b67d2de874d065866e" } }, + { + "identity" : "tree-sitter-ocaml", + "kind" : "remoteSourceControl", + "location" : "https://github.com/tree-sitter/tree-sitter-ocaml", + "state" : { + "branch" : "master", + "revision" : "0b12614ded3ec7ed7ab7933a9ba4f695ba4c342e" + } + }, { "identity" : "tree-sitter-swift", "kind" : "remoteSourceControl", diff --git a/Edit/Modules/SyntaxService/LanguageProfile+Profiles.swift b/Edit/Modules/SyntaxService/LanguageProfile+Profiles.swift index c6b07cb..65d80b0 100644 --- a/Edit/Modules/SyntaxService/LanguageProfile+Profiles.swift +++ b/Edit/Modules/SyntaxService/LanguageProfile+Profiles.swift @@ -4,6 +4,7 @@ import SwiftTreeSitter import UniformTypeIdentifiers import TreeSitterGo +import TreeSitterOCaml import TreeSitterMarkdown import TreeSitterMarkdownInline import TreeSitterSwift @@ -18,6 +19,10 @@ extension LanguageProfile { return LanguageProfile.markdownInlineProfile } + if utType.conforms(to: .ocamlSource) { + return LanguageProfile.ocamlProfile + } + if utType.conforms(to: .swiftSource) { return LanguageProfile.swiftProfile } @@ -47,6 +52,16 @@ extension LanguageProfile { bundleName: "TreeSitterMarkdown_TreeSitterMarkdownInline" ) + static let ocamlProfile = LanguageProfile( + name: "OCaml", + language: Language(tree_sitter_ocaml()) + ) + + static let ocamlInterfaceProfile = LanguageProfile( + name: "OCaml", + language: Language(tree_sitter_ocaml_interface()) + ) + static let swiftProfile = LanguageProfile( name: "Swift", language: Language(tree_sitter_swift()) diff --git a/Edit/Resources/Info.plist b/Edit/Resources/Info.plist index b525c46..9d7791e 100644 --- a/Edit/Resources/Info.plist +++ b/Edit/Resources/Info.plist @@ -67,6 +67,23 @@ https://updates.chimehq.com/com.chimehq.Edit/appcast.xml UTImportedTypeDeclarations + + UTTypeConformsTo + + public.source-code + + UTTypeDescription + OCaml Source + UTTypeIdentifier + org.ocaml.ocaml + UTTypeTagSpecification + + public.filename-extension + + ml + + + UTTypeConformsTo diff --git a/EditIntents/HighlightIntent.swift b/EditIntents/HighlightIntent.swift index 8f86acc..832ac44 100644 --- a/EditIntents/HighlightIntent.swift +++ b/EditIntents/HighlightIntent.swift @@ -10,15 +10,17 @@ import UniformTypeIdentifiers /// /// This must be defined within the same module as any AppIntent that uses it. public enum RootLanguage: String, Hashable, CaseIterable, Sendable { - case swift = "Swift" case go = "Go" case markdown = "Markdown" + case ocaml = "OCaml" + case swift = "Swift" var typeIdentifier: UTType { switch self { - case .swift: .swiftSource case .go: .goSource case .markdown: .markdown + case .ocaml: .ocamlSource + case .swift: .swiftSource } } } @@ -27,9 +29,10 @@ extension RootLanguage: AppEnum { public static var typeDisplayRepresentation: TypeDisplayRepresentation { "Language" } public static var caseDisplayRepresentations: [RootLanguage: DisplayRepresentation] { [ - .swift: "Swift", .go: "Go", .markdown: "Markdown", + .ocaml: "OCaml", + .swift: "Swift", ] } }