diff --git a/Configurations/NonSwiftWorkaround.xcconfig b/Configurations/NonSwiftWorkaround.xcconfig index 467476c..638c0fc 100644 --- a/Configurations/NonSwiftWorkaround.xcconfig +++ b/Configurations/NonSwiftWorkaround.xcconfig @@ -17,6 +17,7 @@ OTHER_SWIFT_FLAGS = $(inherited) -Xcc -fmodule-map-file=$(GENERATED_MODULEMAP_DI OTHER_SWIFT_FLAGS = $(inherited) -Xcc -fmodule-map-file=$(GENERATED_MODULEMAP_DIR)/TreeSitterGosum.modulemap OTHER_SWIFT_FLAGS = $(inherited) -Xcc -fmodule-map-file=$(GENERATED_MODULEMAP_DIR)/TreeSitterGoWork.modulemap OTHER_SWIFT_FLAGS = $(inherited) -Xcc -fmodule-map-file=$(GENERATED_MODULEMAP_DIR)/TreeSitterHTML.modulemap +OTHER_SWIFT_FLAGS = $(inherited) -Xcc -fmodule-map-file=$(GENERATED_MODULEMAP_DIR)/TreeSitterJavaScript.modulemap OTHER_SWIFT_FLAGS = $(inherited) -Xcc -fmodule-map-file=$(GENERATED_MODULEMAP_DIR)/TreeSitterJSON.modulemap OTHER_SWIFT_FLAGS = $(inherited) -Xcc -fmodule-map-file=$(GENERATED_MODULEMAP_DIR)/TreeSitterMarkdown.modulemap OTHER_SWIFT_FLAGS = $(inherited) -Xcc -fmodule-map-file=$(GENERATED_MODULEMAP_DIR)/TreeSitterMarkdownInline.modulemap diff --git a/Dependencies/Package.swift b/Dependencies/Package.swift index 958c6fa..21b0e05 100644 --- a/Dependencies/Package.swift +++ b/Dependencies/Package.swift @@ -22,6 +22,7 @@ let package = Package( .package(url: "https://github.com/camdencheek/tree-sitter-go-mod", branch: "main"), .package(url: "https://github.com/tree-sitter-grammars/tree-sitter-go-sum", branch: "master"), .package(url: "https://github.com/mattmassicotte/tree-sitter-go-work", branch: "feature/spm"), + .package(url: "https://github.com/tree-sitter/tree-sitter-javascript", branch: "master"), .package(url: "https://github.com/tree-sitter/tree-sitter-json", branch: "master"), .package(url: "https://github.com/tree-sitter-grammars/tree-sitter-markdown", branch: "split_parser"), .package(url: "https://github.com/tree-sitter/tree-sitter-ocaml", branch: "master"), @@ -44,6 +45,7 @@ let package = Package( .product(name: "TreeSitterGosum", package: "tree-sitter-go-sum"), .product(name: "TreeSitterGoWork", package: "tree-sitter-go-work"), .product(name: "TreeSitterHTML", package: "tree-sitter-html"), + .product(name: "TreeSitterJavaScript", package: "tree-sitter-javascript"), .product(name: "TreeSitterJSON", package: "tree-sitter-json"), .product(name: "TreeSitterMarkdown", package: "tree-sitter-markdown"), .product(name: "TreeSitterOCaml", package: "tree-sitter-ocaml"), diff --git a/Dependencies/Sources/TreeSitterParsers/TreeSitterParsers.swift b/Dependencies/Sources/TreeSitterParsers/TreeSitterParsers.swift index da171f5..ea01607 100644 --- a/Dependencies/Sources/TreeSitterParsers/TreeSitterParsers.swift +++ b/Dependencies/Sources/TreeSitterParsers/TreeSitterParsers.swift @@ -8,6 +8,7 @@ @_exported import TreeSitterGosum @_exported import TreeSitterGoWork @_exported import TreeSitterHTML +@_exported import TreeSitterJavaScript @_exported import TreeSitterJSON @_exported import TreeSitterMarkdown @_exported import TreeSitterMarkdownInline diff --git a/Edit/Modules/SyntaxService/LanguageProfile+Profiles.swift b/Edit/Modules/SyntaxService/LanguageProfile+Profiles.swift index 228a000..4f1d9b6 100644 --- a/Edit/Modules/SyntaxService/LanguageProfile+Profiles.swift +++ b/Edit/Modules/SyntaxService/LanguageProfile+Profiles.swift @@ -40,6 +40,10 @@ extension LanguageProfile { return LanguageProfile.htmlProfile } + if utType.conforms(to: .javaScript) { + return LanguageProfile.javaScriptProfile + } + if utType.conforms(to: .json) { return LanguageProfile.jsonProfile } @@ -131,6 +135,11 @@ extension LanguageProfile { language: Language(tree_sitter_html()) ) + static let javaScriptProfile = LanguageProfile( + RootLanguage.javaScript, + language: Language(tree_sitter_javascript()) + ) + static let jsonProfile = LanguageProfile( RootLanguage.json, language: Language(tree_sitter_json()) diff --git a/Edit/Modules/SyntaxService/RootLanguage.swift b/Edit/Modules/SyntaxService/RootLanguage.swift index 3ce8ba6..4af54e5 100644 --- a/Edit/Modules/SyntaxService/RootLanguage.swift +++ b/Edit/Modules/SyntaxService/RootLanguage.swift @@ -17,6 +17,7 @@ public enum RootLanguage: Hashable, CaseIterable, Sendable { case goSum case goWork case html + case javaScript case json case markdown case ocaml @@ -38,6 +39,7 @@ public enum RootLanguage: Hashable, CaseIterable, Sendable { case .goSum: .goSumFile case .goWork: .goWorkFile case .html: .html + case .javaScript: .javaScript case .json: .json case .markdown: .markdown case .ocaml: .ocamlSource @@ -77,6 +79,8 @@ extension RootLanguage: RawRepresentable { self = .goWork case "html": self = .html + case "javascript": + self = .javaScript case "json": self = .json case "markdown": @@ -120,6 +124,8 @@ extension RootLanguage: RawRepresentable { "Go Work" case .html: "HTML" + case .javaScript: + "JavaScript" case .json: "JSON" case .markdown: diff --git a/EditIntents/HighlightIntent.swift b/EditIntents/HighlightIntent.swift index 61f0575..1153b12 100644 --- a/EditIntents/HighlightIntent.swift +++ b/EditIntents/HighlightIntent.swift @@ -20,6 +20,7 @@ extension RootLanguage: AppEnum { .goSum: "Go Sum", .goWork: "Go Work", .html: "HTML", + .javaScript: "JavaScript", .json: "JSON", .markdown: "Markdown", .ocaml: "OCaml", diff --git a/QuickLookPreview/Info.plist b/QuickLookPreview/Info.plist index d6dfedf..505b84d 100644 --- a/QuickLookPreview/Info.plist +++ b/QuickLookPreview/Info.plist @@ -31,6 +31,7 @@ org.rust-lang.rust-script public.shell-script public.swift-source + com.netscape.javascript-source QLSupportsSearchableItems