diff --git a/CodeLanguages-Container/CodeLanguages-Container.xcodeproj/project.pbxproj b/CodeLanguages-Container/CodeLanguages-Container.xcodeproj/project.pbxproj index 2dae242..534db91 100644 --- a/CodeLanguages-Container/CodeLanguages-Container.xcodeproj/project.pbxproj +++ b/CodeLanguages-Container/CodeLanguages-Container.xcodeproj/project.pbxproj @@ -34,6 +34,12 @@ 6CE117FC2CEA7CF80082D393 /* TreeSitterDart in Frameworks */ = {isa = PBXBuildFile; productRef = 6CE117FB2CEA7CF80082D393 /* TreeSitterDart */; }; 6CEC70FE29C3A85000B61C7A /* TreeSitterRegex in Frameworks */ = {isa = PBXBuildFile; productRef = 6CEC70FD29C3A85000B61C7A /* TreeSitterRegex */; }; 6CF2B8412CE978F100CBE5D1 /* TreeSitterDart in Frameworks */ = {isa = PBXBuildFile; productRef = 6CF2B8402CE978F100CBE5D1 /* TreeSitterDart */; }; + 76BC51E22F03A6D50030E59A /* TreeSitterR in Frameworks */ = {isa = PBXBuildFile; productRef = 76BC51E12F03A6D50030E59A /* TreeSitterR */; }; + 76BC51E52F03ACB50030E59A /* TreeSitterXML in Frameworks */ = {isa = PBXBuildFile; productRef = 76BC51E42F03ACB50030E59A /* TreeSitterXML */; }; + 76BC51EF2F03B69B0030E59A /* TreeSitterMatlab in Frameworks */ = {isa = PBXBuildFile; productRef = 76BC51EE2F03B69B0030E59A /* TreeSitterMatlab */; }; + 76BC52012F03C0000030E59A /* TreeSitterMake in Frameworks */ = {isa = PBXBuildFile; productRef = 76BC52002F03C0000030E59A /* TreeSitterMake */; }; + 76BC52042F03C0010030E59A /* TreeSitterIni in Frameworks */ = {isa = PBXBuildFile; productRef = 76BC52032F03C0010030E59A /* TreeSitterIni */; }; + 76BC52072F03C0020030E59A /* TreeSitterProperties in Frameworks */ = {isa = PBXBuildFile; productRef = 76BC52062F03C0020030E59A /* TreeSitterProperties */; }; 8E74B41D2A4C88ED003A9550 /* TreeSitterHTML in Frameworks */ = {isa = PBXBuildFile; productRef = 8E74B41C2A4C88ED003A9550 /* TreeSitterHTML */; }; 8E7B0EA92A5D9BB60040DDAB /* TreeSitterTOML in Frameworks */ = {isa = PBXBuildFile; productRef = 8E7B0EA82A5D9BB60040DDAB /* TreeSitterTOML */; }; 8E7B8ABD2A5D916F00CFC1A7 /* TreeSitterPython in Frameworks */ = {isa = PBXBuildFile; productRef = 8E7B8ABC2A5D916F00CFC1A7 /* TreeSitterPython */; }; @@ -67,6 +73,7 @@ 285BF67329AAA45B00641989 /* TreeSitterLua in Frameworks */, 8E87F9542A4B7DC1008C7E13 /* TreeSitterScala in Frameworks */, 6CE117F92CEA7BDC0082D393 /* TreeSitterDart in Frameworks */, + 76BC51E22F03A6D50030E59A /* TreeSitterR in Frameworks */, 2846B262296BA1CF005F60B6 /* TreeSitterDockerfile in Frameworks */, 9D73992A2A5A30A400CEF6E8 /* TreeSitterPerl in Frameworks */, 9D6E74512A2B9B2A0070701E /* TreeSitterOCaml in Frameworks */, @@ -78,8 +85,13 @@ 28B3F03C290C363E000CD04D /* TreeSitterGo in Frameworks */, 28B3F05D290C3709000CD04D /* TreeSitterSwift in Frameworks */, 28B9F7AA290DDAC900245748 /* TreeSitterBash in Frameworks */, + 76BC51EF2F03B69B0030E59A /* TreeSitterMatlab in Frameworks */, + 76BC52012F03C0000030E59A /* TreeSitterMake in Frameworks */, + 76BC52042F03C0010030E59A /* TreeSitterIni in Frameworks */, + 76BC52072F03C0020030E59A /* TreeSitterProperties in Frameworks */, 28B3F030290C35F9000CD04D /* TreeSitterCPP in Frameworks */, 28B3F04E290C3698000CD04D /* TreeSitterJSON in Frameworks */, + 76BC51E52F03ACB50030E59A /* TreeSitterXML in Frameworks */, 28B3F033290C3608000CD04D /* TreeSitterCSharp in Frameworks */, 28B3F03F290C364D000CD04D /* TreeSitterGoMod in Frameworks */, 28B3F063290C372D000CD04D /* TreeSitterZig in Frameworks */, @@ -204,6 +216,12 @@ 6CF2B8402CE978F100CBE5D1 /* TreeSitterDart */, 6CE117F82CEA7BDC0082D393 /* TreeSitterDart */, 6CE117FB2CEA7CF80082D393 /* TreeSitterDart */, + 76BC51E12F03A6D50030E59A /* TreeSitterR */, + 76BC51E42F03ACB50030E59A /* TreeSitterXML */, + 76BC51EE2F03B69B0030E59A /* TreeSitterMatlab */, + 76BC52002F03C0000030E59A /* TreeSitterMake */, + 76BC52032F03C0010030E59A /* TreeSitterIni */, + 76BC52062F03C0020030E59A /* TreeSitterProperties */, ); productName = "CodeLanguages-Container"; productReference = 28B3F00C290C207D000CD04D /* CodeLanguages_Container.framework */; @@ -271,6 +289,12 @@ 6C0B93A62B5DD95500323006 /* XCRemoteSwiftPackageReference "tree-sitter-css" */, 6C7CA2AB2CE9743E006D9D9A /* XCRemoteSwiftPackageReference "tree-sitter-objc" */, 6CE117FA2CEA7CF80082D393 /* XCRemoteSwiftPackageReference "tree-sitter-dart" */, + 76BC51E02F03A6D50030E59A /* XCRemoteSwiftPackageReference "tree-sitter-r" */, + 76BC51E32F03ACB50030E59A /* XCRemoteSwiftPackageReference "tree-sitter-xml" */, + 76BC51ED2F03B69B0030E59A /* XCRemoteSwiftPackageReference "tree-sitter-matlab" */, + 76BC51FF2F03C0000030E59A /* XCRemoteSwiftPackageReference "tree-sitter-make" */, + 76BC52022F03C0010030E59A /* XCRemoteSwiftPackageReference "tree-sitter-ini" */, + 76BC52052F03C0020030E59A /* XCRemoteSwiftPackageReference "tree-sitter-properties" */, ); productRefGroup = 28B3F00D290C207D000CD04D /* Products */; projectDirPath = ""; @@ -354,11 +378,13 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; MACOSX_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; + SDKROOT = auto; + SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; VERSIONING_SYSTEM = "apple-generic"; @@ -412,10 +438,12 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; MACOSX_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; - SDKROOT = macosx; + SDKROOT = auto; + SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx"; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; VERSIONING_SYSTEM = "apple-generic"; @@ -712,6 +740,30 @@ kind = branch; }; }; + 76BC51E02F03A6D50030E59A /* XCRemoteSwiftPackageReference "tree-sitter-r" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/r-lib/tree-sitter-r/"; + requirement = { + branch = main; + kind = branch; + }; + }; + 76BC51E32F03ACB50030E59A /* XCRemoteSwiftPackageReference "tree-sitter-xml" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/tree-sitter-grammars/tree-sitter-xml"; + requirement = { + branch = master; + kind = branch; + }; + }; + 76BC51ED2F03B69B0030E59A /* XCRemoteSwiftPackageReference "tree-sitter-matlab" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/kkilchrist/tree-sitter-matlab"; + requirement = { + branch = main; + kind = branch; + }; + }; 8E74B41B2A4C88ED003A9550 /* XCRemoteSwiftPackageReference "tree-sitter-html" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/tree-sitter/tree-sitter-html.git"; @@ -816,6 +868,30 @@ kind = branch; }; }; + 76BC51FF2F03C0000030E59A /* XCRemoteSwiftPackageReference "tree-sitter-make" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/tree-sitter-grammars/tree-sitter-make"; + requirement = { + branch = main; + kind = branch; + }; + }; + 76BC52022F03C0010030E59A /* XCRemoteSwiftPackageReference "tree-sitter-ini" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/justinmk/tree-sitter-ini"; + requirement = { + branch = master; + kind = branch; + }; + }; + 76BC52052F03C0020030E59A /* XCRemoteSwiftPackageReference "tree-sitter-properties" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/tree-sitter-grammars/tree-sitter-properties"; + requirement = { + branch = master; + kind = branch; + }; + }; /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ @@ -947,6 +1023,21 @@ isa = XCSwiftPackageProductDependency; productName = TreeSitterDart; }; + 76BC51E12F03A6D50030E59A /* TreeSitterR */ = { + isa = XCSwiftPackageProductDependency; + package = 76BC51E02F03A6D50030E59A /* XCRemoteSwiftPackageReference "tree-sitter-r" */; + productName = TreeSitterR; + }; + 76BC51E42F03ACB50030E59A /* TreeSitterXML */ = { + isa = XCSwiftPackageProductDependency; + package = 76BC51E32F03ACB50030E59A /* XCRemoteSwiftPackageReference "tree-sitter-xml" */; + productName = TreeSitterXML; + }; + 76BC51EE2F03B69B0030E59A /* TreeSitterMatlab */ = { + isa = XCSwiftPackageProductDependency; + package = 76BC51ED2F03B69B0030E59A /* XCRemoteSwiftPackageReference "tree-sitter-matlab" */; + productName = TreeSitterMatlab; + }; 8E74B41C2A4C88ED003A9550 /* TreeSitterHTML */ = { isa = XCSwiftPackageProductDependency; package = 8E74B41B2A4C88ED003A9550 /* XCRemoteSwiftPackageReference "tree-sitter-html" */; @@ -1012,6 +1103,21 @@ package = 9DFDC3642A02D9BE0023B3BC /* XCRemoteSwiftPackageReference "tree-sitter-markdown" */; productName = TreeSitterMarkdown; }; + 76BC52002F03C0000030E59A /* TreeSitterMake */ = { + isa = XCSwiftPackageProductDependency; + package = 76BC51FF2F03C0000030E59A /* XCRemoteSwiftPackageReference "tree-sitter-make" */; + productName = TreeSitterMake; + }; + 76BC52032F03C0010030E59A /* TreeSitterIni */ = { + isa = XCSwiftPackageProductDependency; + package = 76BC52022F03C0010030E59A /* XCRemoteSwiftPackageReference "tree-sitter-ini" */; + productName = TreeSitterIni; + }; + 76BC52062F03C0020030E59A /* TreeSitterProperties */ = { + isa = XCSwiftPackageProductDependency; + package = 76BC52052F03C0020030E59A /* XCRemoteSwiftPackageReference "tree-sitter-properties" */; + productName = TreeSitterProperties; + }; /* End XCSwiftPackageProductDependency section */ }; rootObject = 28B3F003290C207D000CD04D /* Project object */; diff --git a/CodeLanguages-Container/CodeLanguages-Container.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/CodeLanguages-Container/CodeLanguages-Container.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 43c7efd..bd6b057 100644 --- a/CodeLanguages-Container/CodeLanguages-Container.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/CodeLanguages-Container/CodeLanguages-Container.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "c940c7467f54711e27ceb0cef308954e1fdbcc20f3dd59d96d6efbe29d7a04ba", + "originHash" : "caffc5d1d33c6adda09227d5b8d92c6ab5138ad65deacaecc92b4106ee1e3349", "pins" : [ { "identity" : "tree-sitter-agda", @@ -118,6 +118,15 @@ "revision" : "d742025fa2d8e6100f134a6ea990443aa1f074b3" } }, + { + "identity" : "tree-sitter-ini", + "kind" : "remoteSourceControl", + "location" : "https://github.com/justinmk/tree-sitter-ini", + "state" : { + "branch" : "master", + "revision" : "e4018b5176132b4f3c5d6e61cea383f42288d0f5" + } + }, { "identity" : "tree-sitter-java", "kind" : "remoteSourceControl", @@ -181,6 +190,15 @@ "revision" : "34e60e7f45fc313463c68090d88d742a55d1bd7a" } }, + { + "identity" : "tree-sitter-make", + "kind" : "remoteSourceControl", + "location" : "https://github.com/tree-sitter-grammars/tree-sitter-make", + "state" : { + "branch" : "main", + "revision" : "5e9e8f8ff3387b0edcaa90f46ddf3629f4cfeb1d" + } + }, { "identity" : "tree-sitter-markdown", "kind" : "remoteSourceControl", @@ -190,6 +208,15 @@ "revision" : "5cdc549ab8f461aff876c5be9741027189299cec" } }, + { + "identity" : "tree-sitter-matlab", + "kind" : "remoteSourceControl", + "location" : "https://github.com/kkilchrist/tree-sitter-matlab", + "state" : { + "branch" : "main", + "revision" : "272819e380d7044278ad589e8952e47e3275698e" + } + }, { "identity" : "tree-sitter-objc", "kind" : "remoteSourceControl", @@ -226,6 +253,15 @@ "revision" : "b569a5f2c0d592e67430520d1a0e1f765d83ceb0" } }, + { + "identity" : "tree-sitter-properties", + "kind" : "remoteSourceControl", + "location" : "https://github.com/tree-sitter-grammars/tree-sitter-properties", + "state" : { + "branch" : "master", + "revision" : "6310671b24d4e04b803577b1c675d765cbd5773b" + } + }, { "identity" : "tree-sitter-python", "kind" : "remoteSourceControl", @@ -235,6 +271,15 @@ "revision" : "4bfdd9033a2225cc95032ce77066b7aeca9e2efc" } }, + { + "identity" : "tree-sitter-r", + "kind" : "remoteSourceControl", + "location" : "https://github.com/r-lib/tree-sitter-r/", + "state" : { + "branch" : "main", + "revision" : "0e6ef7741712c09dc3ee6e81c42e919820cc65ef" + } + }, { "identity" : "tree-sitter-regex", "kind" : "remoteSourceControl", @@ -316,6 +361,15 @@ "revision" : "902031343056bc0b11f3e47b33f036a9cf59f58d" } }, + { + "identity" : "tree-sitter-xml", + "kind" : "remoteSourceControl", + "location" : "https://github.com/tree-sitter-grammars/tree-sitter-xml", + "state" : { + "branch" : "master", + "revision" : "863dbc381f44f6c136a399e684383b977bb2beaa" + } + }, { "identity" : "tree-sitter-yaml", "kind" : "remoteSourceControl", diff --git a/CodeLanguages-Container/CodeLanguages-Container/CodeLanguages_Container.h b/CodeLanguages-Container/CodeLanguages-Container/CodeLanguages_Container.h index b27c35d..7b52229 100644 --- a/CodeLanguages-Container/CodeLanguages-Container/CodeLanguages_Container.h +++ b/CodeLanguages-Container/CodeLanguages-Container/CodeLanguages_Container.h @@ -34,6 +34,7 @@ extern TSLanguage *tree_sitter_elixir(); extern TSLanguage *tree_sitter_go(); extern TSLanguage *tree_sitter_gomod(); extern TSLanguage *tree_sitter_haskell(); +extern TSLanguage *tree_sitter_ini(); extern TSLanguage *tree_sitter_html(); extern TSLanguage *tree_sitter_java(); extern TSLanguage *tree_sitter_javascript(); @@ -42,6 +43,7 @@ extern TSLanguage *tree_sitter_json(); extern TSLanguage *tree_sitter_julia(); extern TSLanguage *tree_sitter_kotlin(); extern TSLanguage *tree_sitter_lua(); +extern TSLanguage *tree_sitter_make(); extern TSLanguage *tree_sitter_markdown(); extern TSLanguage *tree_sitter_markdown_inline(); extern TSLanguage *tree_sitter_objc(); @@ -49,7 +51,9 @@ extern TSLanguage *tree_sitter_ocaml(); extern TSLanguage *tree_sitter_ocaml_interface(); extern TSLanguage *tree_sitter_perl(); extern TSLanguage *tree_sitter_php(); +extern TSLanguage *tree_sitter_properties(); extern TSLanguage *tree_sitter_python(); +extern TSLanguage *tree_sitter_r(); extern TSLanguage *tree_sitter_regex(); extern TSLanguage *tree_sitter_ruby(); extern TSLanguage *tree_sitter_rust(); @@ -60,6 +64,7 @@ extern TSLanguage *tree_sitter_toml(); extern TSLanguage *tree_sitter_tsx(); extern TSLanguage *tree_sitter_typescript(); extern TSLanguage *tree_sitter_verilog(); +extern TSLanguage *tree_sitter_xml(); extern TSLanguage *tree_sitter_yaml(); extern TSLanguage *tree_sitter_zig(); diff --git a/CodeLanguagesContainer.xcframework.zip b/CodeLanguagesContainer.xcframework.zip index 9904c2a..a88e9a5 100644 Binary files a/CodeLanguagesContainer.xcframework.zip and b/CodeLanguagesContainer.xcframework.zip differ diff --git a/Package.swift b/Package.swift index 5ff76ab..102db97 100644 --- a/Package.swift +++ b/Package.swift @@ -5,7 +5,7 @@ import PackageDescription let package = Package( name: "CodeEditLanguages", - platforms: [.macOS(.v13)], + platforms: [.macOS(.v13), .iOS(.v16)], products: [ .library( name: "CodeEditLanguages", @@ -23,7 +23,7 @@ let package = Package( name: "CodeEditLanguages", dependencies: ["CodeLanguagesContainer", "SwiftTreeSitter"], resources: [ - .copy("Resources") + .copy("Queries") ], linkerSettings: [.linkedLibrary("c++")] ), diff --git a/README.md b/README.md index aafc036..9b7b39f 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,7 @@ In order to add support for additional languages we have a complete guide on how | [Go](https://github.com/tree-sitter/tree-sitter-go) | ✅ | ✅ | | [Haskell](https://github.com/tree-sitter/tree-sitter-haskell) | ✅ | ✅ | | [HTML](https://github.com/tree-sitter/tree-sitter-html) | ✅ | ✅ | +| [INI](https://github.com/justinmk/tree-sitter-ini) | ✅ | ✅ | | [Java](https://github.com/tree-sitter/tree-sitter-java) | ✅ | ✅ | | [JavaScript/JSX](https://github.com/tree-sitter/tree-sitter-javascript) | ✅ | ✅ | | [JSDoc](https://github.com/tree-sitter/tree-sitter-jsdoc) | ✅ | ✅ | @@ -66,13 +67,16 @@ In order to add support for additional languages we have a complete guide on how | [Julia](https://github.com/tree-sitter/tree-sitter-julia) | ✅ | _not available_ | | [Kotlin](https://github.com/fwcd/tree-sitter-kotlin) | ✅ | ✅ | | [Lua](https://github.com/tree-sitter-grammars/tree-sitter-lua) | ✅ | ✅ | +| [Makefile](https://github.com/tree-sitter-grammars/tree-sitter-make) | ✅ | ✅ | | [Markdown](https://github.com/tree-sitter-grammars/tree-sitter-markdown) | ✅ | ✅ | | [Objective C](https://github.com/tree-sitter-grammars/tree-sitter-objc) | ✅ | ✅ | | [OCaml](https://github.com/tree-sitter/tree-sitter-ocaml) | ✅ | ✅ | | Plain Text | ✅ | _not available_ | | [Perl](https://github.com/ganezdragon/tree-sitter-perl) | ✅ | _not available_ | | [PHP](https://github.com/tree-sitter/tree-sitter-php) | ✅ | ✅ | +| [Properties/.env](https://github.com/tree-sitter-grammars/tree-sitter-properties) | ✅ | ✅ | | [Python](https://github.com/tree-sitter/tree-sitter-python) | ✅ | ✅ | +| [R](https://github.com/r-lib/tree-sitter-r) | ✅ | ✅ | | [Regex](https://github.com/tree-sitter/tree-sitter-regex) | ✅ | ✅ | | [Ruby](https://github.com/mattmassicotte/tree-sitter-ruby) | ✅ | ✅ | | [Rust](https://github.com/tree-sitter/tree-sitter-rust) | ✅ | ✅ | @@ -82,9 +86,28 @@ In order to add support for additional languages we have a complete guide on how | [TOML](https://github.com/cengelbart39/tree-sitter-toml/tree/feature/spm) | ✅ | ✅ | | [TypeScript/TSX](https://github.com/tree-sitter/tree-sitter-typescript) | ✅ | ✅ | | [Verilog](https://github.com/tree-sitter/tree-sitter-verilog) | ✅ | _not available_ | +| [XML](https://github.com/tree-sitter-grammars/tree-sitter-xml) | ✅ | ✅ | | [YAML](https://github.com/tree-sitter-grammars/tree-sitter-yaml.git) | ✅ | ✅ | | [Zig](https://github.com/tree-sitter-grammars/tree-sitter-zig.git) | ✅ | ✅ | +## Building the Framework + +When adding new languages, you need to rebuild the binary framework using `./build_framework.sh`. + +### Troubleshooting + +If the build script fails with: +``` +xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance +``` + +Run this command to point to your Xcode installation: +```bash +sudo xcode-select -s /Applications/Xcode.app/Contents/Developer +``` + +Then run `./build_framework.sh` again. + ## Related Repositories diff --git a/Sources/CodeEditLanguages/CodeLanguage+Definitions.swift b/Sources/CodeEditLanguages/CodeLanguage+Definitions.swift index 56ce3d4..7c9d4f2 100644 --- a/Sources/CodeEditLanguages/CodeLanguage+Definitions.swift +++ b/Sources/CodeEditLanguages/CodeLanguage+Definitions.swift @@ -25,6 +25,7 @@ public extension CodeLanguage { .go, .goMod, .haskell, + .ini, .html, .java, .javascript, @@ -34,6 +35,7 @@ public extension CodeLanguage { .julia, .kotlin, .lua, + .make, .markdown, .markdownInline, .objc, @@ -41,7 +43,9 @@ public extension CodeLanguage { .ocamlInterface, .perl, .php, + .properties, .python, + .r, .regex, .ruby, .rust, @@ -52,6 +56,7 @@ public extension CodeLanguage { .tsx, .typescript, .verilog, + .xml, .yaml, .zig ] @@ -178,6 +183,15 @@ public extension CodeLanguage { highlights: ["folds", "injections", "locals"] ) + /// A language structure for `INI` + static let ini: CodeLanguage = .init( + id: .ini, + tsName: "ini", + extensions: ["ini", "cfg", "conf", "desktop", "directory"], + lineCommentString: ";", + rangeCommentStrings: ("", "") + ) + /// A language structure for `HTML` static let html: CodeLanguage = .init( id: .html, @@ -270,6 +284,15 @@ public extension CodeLanguage { highlights: ["folds", "indents", "injections", "locals", "tags"] ) + /// A language structure for `Makefile` + static let make: CodeLanguage = .init( + id: .make, + tsName: "make", + extensions: ["Makefile", "makefile", "mk", "mak"], + lineCommentString: "#", + rangeCommentStrings: ("", "") + ) + /// A language structure for `Markdown` static let markdown: CodeLanguage = .init( id: .markdown, @@ -342,6 +365,15 @@ public extension CodeLanguage { highlights: ["folds", "indents", "injections", "locals", "tags"] ) + /// A language structure for `Properties` + static let properties: CodeLanguage = .init( + id: .properties, + tsName: "properties", + extensions: ["properties", "env", "env.local", "env.development", "env.production"], + lineCommentString: "#", + rangeCommentStrings: ("", "") + ) + /// A language structure for `Python` static let python: CodeLanguage = .init( id: .python, @@ -354,6 +386,17 @@ public extension CodeLanguage { additionalIdentifiers: ["python2", "python3"] ) + /// A language structure for `R` + static let r: CodeLanguage = .init( + id: .r, + tsName: "r", + extensions: ["r", "R"], + lineCommentString: "#", + rangeCommentStrings: ("", ""), + documentationCommentStrings: [.single("#'")], + additionalIdentifiers: ["Rscript"] + ) + /// A language structure for `Regex` static let regex: CodeLanguage = .init( id: .regex, @@ -462,6 +505,15 @@ public extension CodeLanguage { highlights: ["folds", "injections"] ) + /// A language structure for `XML` + static let xml: CodeLanguage = .init( + id: .xml, + tsName: "xml", + extensions: ["xml", "xsl", "xslt", "xsd", "svg", "plist"], + lineCommentString: "", + rangeCommentStrings: ("") + ) + /// A language structure for `YAML` static let yaml: CodeLanguage = .init( id: .yaml, diff --git a/Sources/CodeEditLanguages/CodeLanguage.swift b/Sources/CodeEditLanguages/CodeLanguage.swift index f8b6681..547487e 100644 --- a/Sources/CodeEditLanguages/CodeLanguage.swift +++ b/Sources/CodeEditLanguages/CodeLanguage.swift @@ -81,7 +81,7 @@ public struct CodeLanguage { internal func queryURL(for highlights: String = "highlights") -> URL? { return resourceURL? - .appendingPathComponent("Resources/tree-sitter-\(tsName)/\(highlights).scm") + .appendingPathComponent("Queries/tree-sitter-\(tsName)/\(highlights).scm") } /// Gets the TSLanguage from `tree-sitter` @@ -111,6 +111,8 @@ public struct CodeLanguage { return tree_sitter_gomod() case .haskell: return tree_sitter_haskell() + case .ini: + return tree_sitter_ini() case .html: return tree_sitter_html() case .java: @@ -129,6 +131,8 @@ public struct CodeLanguage { return tree_sitter_kotlin() case .lua: return tree_sitter_lua() + case .make: + return tree_sitter_make() case .markdown: return tree_sitter_markdown() case .markdownInline: @@ -143,8 +147,12 @@ public struct CodeLanguage { return tree_sitter_perl() case .php: return tree_sitter_php() + case .properties: + return tree_sitter_properties() case .python: return tree_sitter_python() + case .r: + return tree_sitter_r() case .regex: return tree_sitter_regex() case .ruby: @@ -165,6 +173,8 @@ public struct CodeLanguage { return tree_sitter_typescript() case .verilog: return tree_sitter_verilog() + case .xml: + return tree_sitter_xml() case .yaml: return tree_sitter_yaml() case .zig: diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-agda/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-agda/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-agda/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-agda/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-bash/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-bash/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-bash/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-bash/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-c-sharp/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-c-sharp/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-c-sharp/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-c-sharp/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-c-sharp/tags.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-c-sharp/tags.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-c-sharp/tags.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-c-sharp/tags.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-c/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-c/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-c/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-c/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-c/tags.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-c/tags.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-c/tags.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-c/tags.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-cpp/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-cpp/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-cpp/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-cpp/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-cpp/injections.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-cpp/injections.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-cpp/injections.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-cpp/injections.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-cpp/tags.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-cpp/tags.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-cpp/tags.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-cpp/tags.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-css/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-css/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-css/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-css/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-dart/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-dart/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-dart/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-dart/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-dart/tags.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-dart/tags.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-dart/tags.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-dart/tags.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-dart/test.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-dart/test.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-dart/test.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-dart/test.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-dockerfile/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-dockerfile/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-dockerfile/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-dockerfile/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-elixir/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-elixir/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-elixir/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-elixir/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-elixir/injections.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-elixir/injections.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-elixir/injections.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-elixir/injections.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-elixir/tags.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-elixir/tags.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-elixir/tags.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-elixir/tags.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-go-mod/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-go-mod/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-go-mod/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-go-mod/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-go-mod/structure.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-go-mod/structure.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-go-mod/structure.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-go-mod/structure.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-go/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-go/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-go/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-go/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-go/structure.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-go/structure.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-go/structure.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-go/structure.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-go/tags.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-go/tags.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-go/tags.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-go/tags.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-haskell/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-haskell/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-haskell/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-haskell/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-haskell/locals.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-haskell/locals.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-haskell/locals.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-haskell/locals.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-html/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-html/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-html/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-html/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-html/injections.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-html/injections.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-html/injections.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-html/injections.scm diff --git a/Sources/CodeEditLanguages/Queries/tree-sitter-ini/folds.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-ini/folds.scm new file mode 100644 index 0000000..911798f --- /dev/null +++ b/Sources/CodeEditLanguages/Queries/tree-sitter-ini/folds.scm @@ -0,0 +1 @@ +(section) @fold diff --git a/Sources/CodeEditLanguages/Queries/tree-sitter-ini/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-ini/highlights.scm new file mode 100644 index 0000000..4da3c7b --- /dev/null +++ b/Sources/CodeEditLanguages/Queries/tree-sitter-ini/highlights.scm @@ -0,0 +1,16 @@ +(section_name + (text) @type) ; consistency with toml + +(comment) @comment @spell + +[ + "[" + "]" +] @punctuation.bracket + +"=" @operator + +(setting + (setting_name) @property) + +; (setting_value) @none ; grammar does not support subtypes diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-java/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-java/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-java/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-java/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-java/tags.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-java/tags.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-java/tags.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-java/tags.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-javascript/highlights-jsx.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-javascript/highlights-jsx.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-javascript/highlights-jsx.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-javascript/highlights-jsx.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-javascript/highlights-params.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-javascript/highlights-params.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-javascript/highlights-params.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-javascript/highlights-params.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-javascript/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-javascript/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-javascript/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-javascript/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-javascript/injections.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-javascript/injections.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-javascript/injections.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-javascript/injections.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-javascript/locals.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-javascript/locals.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-javascript/locals.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-javascript/locals.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-javascript/tags.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-javascript/tags.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-javascript/tags.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-javascript/tags.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-jsdoc/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-jsdoc/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-jsdoc/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-jsdoc/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-json/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-json/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-json/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-json/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-kotlin/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-kotlin/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-kotlin/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-kotlin/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-lua/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-lua/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-lua/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-lua/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-lua/injections.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-lua/injections.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-lua/injections.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-lua/injections.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-lua/locals.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-lua/locals.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-lua/locals.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-lua/locals.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-lua/tags.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-lua/tags.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-lua/tags.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-lua/tags.scm diff --git a/Sources/CodeEditLanguages/Queries/tree-sitter-make/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-make/highlights.scm new file mode 100644 index 0000000..9ea8016 --- /dev/null +++ b/Sources/CodeEditLanguages/Queries/tree-sitter-make/highlights.scm @@ -0,0 +1,171 @@ +[ + "(" + ")" + "{" + "}" +] @punctuation.bracket + +[ + ":" + "&:" + "::" + "|" + ";" + "\"" + "'" + "," +] @punctuation.delimiter + +[ + "$" + "$$" +] @punctuation.special + +(automatic_variable + [ "@" "%" "<" "?" "^" "+" "/" "*" "D" "F"] @punctuation.special) + +(automatic_variable + "/" @error . ["D" "F"]) + +[ + "=" + ":=" + "::=" + "?=" + "+=" + "!=" + "@" + "-" + "+" +] @operator + +[ + (text) + (string) + (raw_text) +] @string + +(variable_assignment (word) @string) + +[ + "ifeq" + "ifneq" + "ifdef" + "ifndef" + "else" + "endif" + "if" + "or" ; boolean functions are conditional in make grammar + "and" +] @conditional + +"foreach" @repeat + +[ + "define" + "endef" + "vpath" + "undefine" + "export" + "unexport" + "override" + "private" +; "load" +] @keyword + +[ + "include" + "sinclude" + "-include" +] @include + +[ + "subst" + "patsubst" + "strip" + "findstring" + "filter" + "filter-out" + "sort" + "word" + "words" + "wordlist" + "firstword" + "lastword" + "dir" + "notdir" + "suffix" + "basename" + "addsuffix" + "addprefix" + "join" + "wildcard" + "realpath" + "abspath" + "call" + "eval" + "file" + "value" + "shell" +] @keyword.function + +[ + "error" + "warning" + "info" +] @exception + +;; Variable +(variable_assignment + name: (word) @constant) + +(variable_reference + (word) @constant) + +(comment) @comment + +((word) @clean @string.regex + (#match? @clean "[%\*\?]")) + +(function_call + function: "error" + (arguments (text) @text.danger)) + +(function_call + function: "warning" + (arguments (text) @text.warning)) + +(function_call + function: "info" + (arguments (text) @text.note)) + +;; Install Command Categories +;; Others special variables +;; Variables Used by Implicit Rules +[ + "VPATH" + ".RECIPEPREFIX" +] @constant.builtin + +(variable_assignment + name: (word) @clean @constant.builtin + (#match? @clean "^(AR|AS|CC|CXX|CPP|FC|M2C|PC|CO|GET|LEX|YACC|LINT|MAKEINFO|TEX|TEXI2DVI|WEAVE|CWEAVE|TANGLE|CTANGLE|RM|ARFLAGS|ASFLAGS|CFLAGS|CXXFLAGS|COFLAGS|CPPFLAGS|FFLAGS|GFLAGS|LDFLAGS|LDLIBS|LFLAGS|YFLAGS|PFLAGS|RFLAGS|LINTFLAGS|PRE_INSTALL|POST_INSTALL|NORMAL_INSTALL|PRE_UNINSTALL|POST_UNINSTALL|NORMAL_UNINSTALL|MAKEFILE_LIST|MAKE_RESTARTS|MAKE_TERMOUT|MAKE_TERMERR|\.DEFAULT_GOAL|\.RECIPEPREFIX|\.EXTRA_PREREQS)$")) + +(variable_reference + (word) @clean @constant.builtin + (#match? @clean "^(AR|AS|CC|CXX|CPP|FC|M2C|PC|CO|GET|LEX|YACC|LINT|MAKEINFO|TEX|TEXI2DVI|WEAVE|CWEAVE|TANGLE|CTANGLE|RM|ARFLAGS|ASFLAGS|CFLAGS|CXXFLAGS|COFLAGS|CPPFLAGS|FFLAGS|GFLAGS|LDFLAGS|LDLIBS|LFLAGS|YFLAGS|PFLAGS|RFLAGS|LINTFLAGS|PRE_INSTALL|POST_INSTALL|NORMAL_INSTALL|PRE_UNINSTALL|POST_UNINSTALL|NORMAL_UNINSTALL|MAKEFILE_LIST|MAKE_RESTARTS|MAKE_TERMOUT|MAKE_TERMERR|\.DEFAULT_GOAL|\.RECIPEPREFIX|\.EXTRA_PREREQS\.VARIABLES|\.FEATURES|\.INCLUDE_DIRS|\.LOADED)$")) + +;; Standart targets +(targets + (word) @constant.macro + (#match? @constant.macro "^(all|install|install-html|install-dvi|install-pdf|install-ps|uninstall|install-strip|clean|distclean|mostlyclean|maintainer-clean|TAGS|info|dvi|html|pdf|ps|dist|check|installcheck|installdirs)$")) + +(targets + (word) @constant.macro + (#match? @constant.macro "^(all|install|install-html|install-dvi|install-pdf|install-ps|uninstall|install-strip|clean|distclean|mostlyclean|maintainer-clean|TAGS|info|dvi|html|pdf|ps|dist|check|installcheck|installdirs)$")) + +;; Builtin targets +(targets + (word) @constant.macro + (#match? @constant.macro "^\.(PHONY|SUFFIXES|DEFAULT|PRECIOUS|INTERMEDIATE|SECONDARY|SECONDEXPANSION|DELETE_ON_ERROR|IGNORE|LOW_RESOLUTION_TIME|SILENT|EXPORT_ALL_VARIABLES|NOTPARALLEL|ONESHELL|POSIX)$")) + diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-markdown-inline/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-markdown-inline/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-markdown-inline/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-markdown-inline/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-markdown-inline/injections.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-markdown-inline/injections.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-markdown-inline/injections.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-markdown-inline/injections.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-markdown/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-markdown/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-markdown/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-markdown/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-markdown/injections.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-markdown/injections.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-markdown/injections.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-markdown/injections.scm diff --git a/Sources/CodeEditLanguages/Queries/tree-sitter-matlab/context.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-matlab/context.scm new file mode 100644 index 0000000..725c10c --- /dev/null +++ b/Sources/CodeEditLanguages/Queries/tree-sitter-matlab/context.scm @@ -0,0 +1,41 @@ +(function_definition + (block (_) @context.end) +) @context + +(while_statement + (block (_) @context.end) +) @context + +(for_statement + (block (_) @context.end) +) @context + +(if_statement + (block (_) @context.end) +) @context + +(elseif_clause + (block (_) @context.end) +) @context + +(else_clause + (block (_) @context.end) +) @context + +(switch_statement) @context + +(case_clause + (block (_) @context.end) +) @context + +(otherwise_clause + (block (_) @context.end) +) @context + +(try_statement + "try" + (block (_) @context.end) @context + "end") +(catch_clause + "catch" + (block (_) @context.end) @context) diff --git a/Sources/CodeEditLanguages/Queries/tree-sitter-matlab/folds.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-matlab/folds.scm new file mode 100644 index 0000000..dad9ea1 --- /dev/null +++ b/Sources/CodeEditLanguages/Queries/tree-sitter-matlab/folds.scm @@ -0,0 +1,11 @@ +[(if_statement) + (for_statement) + (while_statement) + (switch_statement) + (try_statement) + (function_definition) + (class_definition) + (enumeration) + (events) + (methods) + (properties)] @fold diff --git a/Sources/CodeEditLanguages/Queries/tree-sitter-matlab/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-matlab/highlights.scm new file mode 100644 index 0000000..d3f8cdd --- /dev/null +++ b/Sources/CodeEditLanguages/Queries/tree-sitter-matlab/highlights.scm @@ -0,0 +1,157 @@ +; Includes + +((command_name) @include + (#eq? @include "import")) + +; Keywords + +[ + "arguments" + "classdef" + "end" + "enumeration" + "events" + "global" + "methods" + "persistent" + "properties" +] @keyword + +; Conditionals + +(if_statement [ "if" "end" ] @conditional) +(elseif_clause "elseif" @conditional) +(else_clause "else" @conditional) +(switch_statement [ "switch" "end" ] @conditional) +(case_clause "case" @conditional) +(otherwise_clause "otherwise" @conditional) +(break_statement) @conditional + +; Repeats + +(for_statement [ "for" "parfor" "end" ] @repeat) +(while_statement [ "while" "end" ] @repeat) +(continue_statement) @repeat + +; Exceptions + +(try_statement [ "try" "end" ] @exception) +(catch_clause "catch" @exception) + +; Variables + +(identifier) @variable + +; Constants + +(events (identifier) @constant) +(attribute (identifier) @constant) + +"~" @constant.builtin + +; Fields/Properties + +(field_expression field: (identifier) @field) + +(superclass "." (identifier) @property) + +(property_name "." (identifier) @property) + +(property name: (identifier) @property) + +; Types + +(class_definition name: (identifier) @type) + +(attributes (identifier) @constant) + +(enum . (identifier) @type) + +((identifier) @type + (#lua-match? @type "^_*[A-Z][a-zA-Z0-9_]+$")) + +; Functions + +(function_definition + "function" @keyword.function + name: (identifier) @function + [ "end" "endfunction" ]? @keyword.function) + +(function_signature name: (identifier) @function) + +(function_call + name: (identifier) @function.call) + +(handle_operator (identifier) @function) + +(validation_functions (identifier) @function) + +(command (command_name) @function.call) +(command_argument) @parameter + +(return_statement) @keyword.return + +; Parameters + +(function_arguments (identifier) @parameter) + +; Punctuation + +[ ";" "," "." ] @punctuation.delimiter + +[ "(" ")" "[" "]" "{" "}" ] @punctuation.bracket + +; Operators + +[ + "+" + ".+" + "-" + ".*" + "*" + ".*" + "/" + "./" + "\\" + ".\\" + "^" + ".^" + "'" + ".'" + "|" + "&" + "?" + "@" + "<" + "<=" + ">" + ">=" + "==" + "~=" + "=" + "&&" + "||" + ":" +] @operator + +; Literals + +(string) @string + +(escape_sequence) @string.escape +(formatting_sequence) @string.special + +(number) @number + +((identifier) @boolean + (#eq? @boolean "true")) +((identifier) @boolean + (#eq? @boolean "false")) + +; Comments + +[ (comment) (line_continuation) ] @comment @spell + +; Errors + +(ERROR) @error diff --git a/Sources/CodeEditLanguages/Queries/tree-sitter-matlab/indents.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-matlab/indents.scm new file mode 100644 index 0000000..fa90dd9 --- /dev/null +++ b/Sources/CodeEditLanguages/Queries/tree-sitter-matlab/indents.scm @@ -0,0 +1,36 @@ +"end" @indent.end @indent.branch + +[ + (arguments_statement) + (if_statement) + (for_statement) + (while_statement) + (switch_statement) + (try_statement) + (function_definition) + (class_definition) + (enumeration) + (events) + (methods) + (properties) +] @indent.begin + +[ + "elseif" + "else" + "case" + "otherwise" + "catch" +] @indent.branch + +((matrix (row) @indent.align) + (#set! indent.open_delimiter "[") + (#set! indent.close_delimiter "]")) +((cell (row) @indent.align) + (#set! indent.open_delimiter "{") + (#set! indent.close_delimiter "}")) +((parenthesis) @indent.align + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")")) + +(comment) @indent.auto diff --git a/Sources/CodeEditLanguages/Queries/tree-sitter-matlab/injections.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-matlab/injections.scm new file mode 100644 index 0000000..4bb7d67 --- /dev/null +++ b/Sources/CodeEditLanguages/Queries/tree-sitter-matlab/injections.scm @@ -0,0 +1 @@ +(comment) @comment diff --git a/Sources/CodeEditLanguages/Queries/tree-sitter-matlab/locals.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-matlab/locals.scm new file mode 100644 index 0000000..a6ca6ae --- /dev/null +++ b/Sources/CodeEditLanguages/Queries/tree-sitter-matlab/locals.scm @@ -0,0 +1,20 @@ +; References + +(identifier) @reference + +; Definitions + +(function_definition + name: (identifier) @definition.function + (function_arguments + (identifier)* @definition.parameter + ("," (identifier) @definition.parameter)*)?) @scope + +(assignment left: (identifier) @definition.var) +(multioutput_variable (identifier) @definition.var) + +(iterator . (identifier) @definition.var) +(lambda (arguments (identifier) @definition.parameter)) +(global_operator (identifier) @definition.var) +(persistent_operator (identifier) @definition.var) +(catch_clause (identifier) @definition) diff --git a/Sources/CodeEditLanguages/Queries/tree-sitter-matlab/tags.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-matlab/tags.scm new file mode 100644 index 0000000..ae8e9ae --- /dev/null +++ b/Sources/CodeEditLanguages/Queries/tree-sitter-matlab/tags.scm @@ -0,0 +1,10 @@ + (class_definition + name: (identifier) @name) @definition.class + +(function_definition + name: (identifier) @name) @definition.function + +(function_call + name: (identifier) @name) @reference.call + +(command (command_name) @name) @reference.call diff --git a/Sources/CodeEditLanguages/Queries/tree-sitter-matlab/textobjects.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-matlab/textobjects.scm new file mode 100644 index 0000000..27113c3 --- /dev/null +++ b/Sources/CodeEditLanguages/Queries/tree-sitter-matlab/textobjects.scm @@ -0,0 +1,110 @@ +(_ (block) @block.inner) @block.outer +(block (_) @statement.outer) +(source_file (_) @statement.outer) + +(function_call + (arguments)? @call.inner) @call.outer +((arguments ","? @_start . (_) @parameter.inner . ) + (#make-range! "parameter.outer" @_start @parameter.inner)) +((arguments (_) @parameter.inner . "," @_end) + (#make-range! "parameter.outer" @parameter.inner @_end)) + +(command) @call.outer +(command (command_argument) @parameter.inner @parameter.outer) +(command + (command_argument) @_start (command_argument)* @_end . + (#make-range! "call.inner" @_start @_end)) + +(if_statement + (block) @conditional.inner) @conditional.outer +(if_statement + (elseif_clause + (block) @conditional.inner)) +(if_statement + (else_clause + (block) @conditional.inner)) + +(switch_statement + (case_clause (block) @conditional.inner)) @conditional.outer + +(switch_statement + (otherwise_clause (block) @conditional.inner)) + +(for_statement + (block) @loop.inner) @loop.outer +(while_statement + (block) @loop.inner) @loop.outer + +(lambda + expression: (_) @function.inner) @function.outer + +(global_operator + (identifier) @parameter.inner) + +(persistent_operator + (identifier) @parameter.inner) + +(function_definition + (block) @function.inner) @function.outer + +(function_output (identifier) @parameter.inner @parameter.outer) + +((function_arguments ","? @_start . (_) @parameter.inner . ) + (#make-range! "parameter.outer" @_start @parameter.inner)) +((function_arguments (_) @parameter.inner . "," @_end) + (#make-range! "parameter.outer" @parameter.inner @_end)) + +((multioutput_variable ","? @_start . (_) @parameter.inner . ) + (#make-range! "parameter.outer" @_start @parameter.inner)) +((multioutput_variable (_) @parameter.inner . "," @_end) + (#make-range! "parameter.outer" @parameter.inner @_end)) + +(try_statement + (block) @conditional.inner) @conditional.outer +(catch_clause + (identifier) @parameter.inner @parameter.outer) +(catch_clause + (block) @conditional.inner) + +(class_definition) @class.outer + +(number) @number.inner +(_ (return_statement) @return.inner @return.outer) +(comment) @comment.outer + +(matrix (row) @parameter.outer) +(cell (row) @parameter.outer) +(row (_) @parameter.inner) + +(assignment + left: (_) @assignment.lhs + (_) @assignment.rhs) @assignment.outer + +((superclasses "&"? @_start . (_) @parameter.inner . ) + (#make-range! "parameter.outer" @_start @parameter.inner)) +((superclasses (_) @parameter.inner . "&" @_end) + (#make-range! "parameter.outer" @parameter.inner @_end)) + +(enum (identifier) @parameter.inner @parameter.outer) + +(property name: (_) @parameter.outer @parameter.inner) + +((enum ","? @_start . (_) @parameter.inner . ) + (#make-range! "parameter.outer" @_start @parameter.inner)) +((enum (_) @parameter.inner . "," @_end) + (#make-range! "parameter.outer" @parameter.inner @_end)) + +((validation_functions ","? @_start . (_) @parameter.inner . ) + (#make-range! "parameter.outer" @_start @parameter.inner)) +((validation_functions (_) @parameter.inner . "," @_end) + (#make-range! "parameter.outer" @parameter.inner @_end)) + +((dimensions ","? @_start . (_) @parameter.inner . ) + (#make-range! "parameter.outer" @_start @parameter.inner)) +((dimensions (_) @parameter.inner . "," @_end) + (#make-range! "parameter.outer" @parameter.inner @_end)) + +((attributes ","? @_start . (_) @parameter.inner . ) + (#make-range! "parameter.outer" @_start @parameter.inner)) +((attributes (_) @parameter.inner . "," @_end) + (#make-range! "parameter.outer" @parameter.inner @_end)) diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-objc/folds.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-objc/folds.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-objc/folds.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-objc/folds.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-objc/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-objc/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-objc/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-objc/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-objc/indents.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-objc/indents.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-objc/indents.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-objc/indents.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-objc/injections.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-objc/injections.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-objc/injections.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-objc/injections.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-objc/locals.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-objc/locals.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-objc/locals.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-objc/locals.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-ocaml/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-ocaml/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-ocaml/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-ocaml/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-ocaml/locals.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-ocaml/locals.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-ocaml/locals.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-ocaml/locals.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-ocaml/tags.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-ocaml/tags.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-ocaml/tags.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-ocaml/tags.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-php/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-php/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-php/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-php/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-php/injections.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-php/injections.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-php/injections.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-php/injections.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-php/tags.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-php/tags.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-php/tags.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-php/tags.scm diff --git a/Sources/CodeEditLanguages/Queries/tree-sitter-properties/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-properties/highlights.scm new file mode 100644 index 0000000..5b71487 --- /dev/null +++ b/Sources/CodeEditLanguages/Queries/tree-sitter-properties/highlights.scm @@ -0,0 +1,28 @@ +(comment) @comment + +(key) @property + +(value) @string + +(value (escape) @string.escape) + +((index) @number + (#match? @number "^[0-9]+$")) + +((substitution (key) @constant) + (#match? @constant "^[A-Z0-9_]+")) + +(substitution + (key) @function + "::" @punctuation.special + (secret) @embedded) + +(property [ "=" ":" ] @operator) + +[ "${" "}" ] @punctuation.special + +(substitution ":" @punctuation.special) + +[ "[" "]" ] @punctuation.bracket + +[ "." "\\" ] @punctuation.delimiter diff --git a/Sources/CodeEditLanguages/Queries/tree-sitter-properties/tags.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-properties/tags.scm new file mode 100644 index 0000000..6b9b2cf --- /dev/null +++ b/Sources/CodeEditLanguages/Queries/tree-sitter-properties/tags.scm @@ -0,0 +1,5 @@ +(property + (key) @name) @definition.property + +(substitution + (key) @name) @reference.property diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-python/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-python/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-python/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-python/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-python/tags.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-python/tags.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-python/tags.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-python/tags.scm diff --git a/Sources/CodeEditLanguages/Queries/tree-sitter-r/describe.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-r/describe.scm new file mode 100644 index 0000000..bc5e6f6 --- /dev/null +++ b/Sources/CodeEditLanguages/Queries/tree-sitter-r/describe.scm @@ -0,0 +1,32 @@ +(call + function: [ + (identifier) @parent_function + (namespace_operator + lhs: (identifier) @parent_pkg (#eq? @parent_pkg "testthat") + rhs: (identifier) @parent_function + ) + ] (#eq? @parent_function "describe") + arguments: (arguments + (argument + value: (string) @parent_desc + ) + (argument + value: (braced_expression + body: (call + function: [ + (identifier) @function + (namespace_operator + lhs: (identifier) @pkg (#eq? @pkg "testthat") + rhs: (identifier) @function + ) + ] (#eq? @function "it") + arguments: (arguments + (argument + value: (string) @desc + ) + ) + ) @call + ) + ) + ) +) @parent_call diff --git a/Sources/CodeEditLanguages/Queries/tree-sitter-r/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-r/highlights.scm new file mode 100644 index 0000000..c632d3e --- /dev/null +++ b/Sources/CodeEditLanguages/Queries/tree-sitter-r/highlights.scm @@ -0,0 +1,112 @@ +; highlights.scm + +; Literals + +(integer) @number +(float) @number +(complex) @number + +(string) @string +(string (string_content (escape_sequence) @string.escape)) + +; Comments + +(comment) @comment + +; Operators + +[ + "?" ":=" "=" "<-" "<<-" "->" "->>" + "~" "|>" "||" "|" "&&" "&" + "<" "<=" ">" ">=" "==" "!=" + "+" "-" "*" "/" "::" ":::" + "**" "^" "$" "@" ":" "!" + "special" +] @operator + +; Punctuation + +[ + "(" ")" + "{" "}" + "[" "]" + "[[" "]]" +] @punctuation.bracket + +(comma) @punctuation.delimiter + +; Variables + +(identifier) @variable + +; Functions + +(binary_operator + lhs: (identifier) @function + operator: "<-" + rhs: (function_definition) +) + +(binary_operator + lhs: (identifier) @function + operator: "=" + rhs: (function_definition) +) + +; Calls + +(call function: (identifier) @function) + +; Parameters + +(parameters (parameter name: (identifier) @variable.parameter)) +(arguments (argument name: (identifier) @variable.parameter)) + +; Namespace + +(namespace_operator lhs: (identifier) @namespace) + +(call + function: (namespace_operator rhs: (identifier) @function) +) + +; Keywords + +(function_definition name: "function" @keyword.function) +(function_definition name: "\\" @operator) + +[ + "in" + (return) + (next) + (break) +] @keyword + +[ + "if" + "else" +] @conditional + +[ + "while" + "repeat" + "for" +] @repeat + +[ + (true) + (false) +] @boolean + +[ + (null) + (inf) + (nan) + (na) + (dots) + (dot_dot_i) +] @constant.builtin + +; Error + +(ERROR) @error diff --git a/Sources/CodeEditLanguages/Queries/tree-sitter-r/locals.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-r/locals.scm new file mode 100644 index 0000000..5d4697a --- /dev/null +++ b/Sources/CodeEditLanguages/Queries/tree-sitter-r/locals.scm @@ -0,0 +1,18 @@ +; locals.scm + +(function_definition) @local.scope + +(argument name: (identifier) @local.definition) +(parameter name: (identifier) @local.definition) + +(binary_operator + lhs: (identifier) @local.definition + operator: "<-") +(binary_operator + lhs: (identifier) @local.definition + operator: "=") +(binary_operator + operator: "->" + rhs: (identifier) @local.definition) + +(identifier) @local.reference diff --git a/Sources/CodeEditLanguages/Queries/tree-sitter-r/tags.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-r/tags.scm new file mode 100644 index 0000000..35ca6c0 --- /dev/null +++ b/Sources/CodeEditLanguages/Queries/tree-sitter-r/tags.scm @@ -0,0 +1,33 @@ +(binary_operator + lhs: (identifier) @name + operator: "<-" + rhs: (function_definition) +) @definition.function + +(binary_operator + lhs: (identifier) @name + operator: "=" + rhs: (function_definition) +) @definition.function + +(binary_operator + lhs: (string) @name + operator: "<-" + rhs: (function_definition) +) @definition.function + +(binary_operator + lhs: (string) @name + operator: "=" + rhs: (function_definition) +) @definition.function + +(call + function: (identifier) @name +) @reference.call + +(call + function: (namespace_operator + rhs: (identifier) @name + ) +) @reference.call diff --git a/Sources/CodeEditLanguages/Queries/tree-sitter-r/test_that.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-r/test_that.scm new file mode 100644 index 0000000..de73262 --- /dev/null +++ b/Sources/CodeEditLanguages/Queries/tree-sitter-r/test_that.scm @@ -0,0 +1,22 @@ +(call + function: [ + (identifier) @function + (namespace_operator + lhs: (identifier) @pkg (#eq? @pkg "testthat") + rhs: (identifier) @function + ) + ] (#eq? @function "test_that") + arguments: [ + (arguments + . (argument value: (string) @desc) . (comma) . (_) . + ) + (arguments + . (_) . (comma) . + (argument + name: (identifier) @param + value: (string) @desc + ) (#eq? @param "desc") + . + ) + ] +) @call diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-regex/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-regex/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-regex/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-regex/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-ruby/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-ruby/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-ruby/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-ruby/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-ruby/locals.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-ruby/locals.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-ruby/locals.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-ruby/locals.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-ruby/tags.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-ruby/tags.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-ruby/tags.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-ruby/tags.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-rust/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-rust/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-rust/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-rust/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-rust/injections.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-rust/injections.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-rust/injections.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-rust/injections.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-rust/tags.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-rust/tags.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-rust/tags.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-rust/tags.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-scala/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-scala/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-scala/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-scala/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-scala/locals.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-scala/locals.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-scala/locals.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-scala/locals.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-sql/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-sql/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-sql/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-sql/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-sql/indents.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-sql/indents.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-sql/indents.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-sql/indents.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-swift/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-swift/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-swift/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-swift/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-swift/locals.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-swift/locals.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-swift/locals.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-swift/locals.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-swift/tags.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-swift/tags.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-swift/tags.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-swift/tags.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-toml/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-toml/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-toml/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-toml/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-typescript/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-typescript/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-typescript/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-typescript/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-typescript/locals.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-typescript/locals.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-typescript/locals.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-typescript/locals.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-typescript/tags.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-typescript/tags.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-typescript/tags.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-typescript/tags.scm diff --git a/Sources/CodeEditLanguages/Queries/tree-sitter-xml/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-xml/highlights.scm new file mode 100644 index 0000000..8255b47 --- /dev/null +++ b/Sources/CodeEditLanguages/Queries/tree-sitter-xml/highlights.scm @@ -0,0 +1,129 @@ +;; XML declaration + +"xml" @keyword + +[ "version" "encoding" ] @property + +(EncName) @string.special + +(VersionNum) @number + +;; Processing instructions + +(PI) @embedded + +(PI (PITarget) @keyword) + +;; Element declaration + +(elementdecl + "ELEMENT" @keyword + (Name) @tag) + +(contentspec + (_ (Name) @property)) + +"#PCDATA" @type.builtin + +[ "EMPTY" "ANY" ] @string.special.symbol + +[ "*" "?" "+" ] @operator + +;; Entity declaration + +(GEDecl + "ENTITY" @keyword + (Name) @constant) + +(GEDecl (EntityValue) @string) + +(NDataDecl + "NDATA" @keyword + (Name) @label) + +;; Parsed entity declaration + +(PEDecl + "ENTITY" @keyword + "%" @operator + (Name) @constant) + +(PEDecl (EntityValue) @string) + +;; Notation declaration + +(NotationDecl + "NOTATION" @keyword + (Name) @constant) + +(NotationDecl + (ExternalID + (SystemLiteral (URI) @string.special))) + +;; Attlist declaration + +(AttlistDecl + "ATTLIST" @keyword + (Name) @tag) + +(AttDef (Name) @property) + +(AttDef (Enumeration (Nmtoken) @string)) + +(DefaultDecl (AttValue) @string) + +[ + (StringType) + (TokenizedType) +] @type.builtin + +(NotationType "NOTATION" @type.builtin) + +[ + "#REQUIRED" + "#IMPLIED" + "#FIXED" +] @attribute + +;; Entities + +(EntityRef) @constant + +((EntityRef) @constant.builtin + (#any-of? @constant.builtin + "&" "<" ">" """ "'")) + +(CharRef) @constant + +(PEReference) @constant + +;; External references + +[ "PUBLIC" "SYSTEM" ] @keyword + +(PubidLiteral) @string.special + +(SystemLiteral (URI) @markup.link) + +;; Delimiters & punctuation + +[ + "" + "" + "" +] @punctuation.delimiter + +[ "(" ")" "[" ] @punctuation.bracket + +[ "\"" "'" ] @punctuation.delimiter + +[ "," "|" "=" ] @operator + +;; Misc + +; FIXME: enable when ts test is fixed +; [ "INCLUDE" "IGNORE" ] @keyword + +(Comment) @comment + +(ERROR) @error diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-yaml/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-yaml/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-yaml/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-yaml/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-zig/folds.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-zig/folds.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-zig/folds.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-zig/folds.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-zig/highlights.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-zig/highlights.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-zig/highlights.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-zig/highlights.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-zig/indents.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-zig/indents.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-zig/indents.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-zig/indents.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-zig/injections.scm b/Sources/CodeEditLanguages/Queries/tree-sitter-zig/injections.scm similarity index 100% rename from Sources/CodeEditLanguages/Resources/tree-sitter-zig/injections.scm rename to Sources/CodeEditLanguages/Queries/tree-sitter-zig/injections.scm diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-agda/folds.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-agda/folds.scm deleted file mode 100644 index 143d49f..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-agda/folds.scm +++ /dev/null @@ -1,19 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (record) - (module) -] @fold diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-agda/injections.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-agda/injections.scm deleted file mode 100644 index 3c59e7b..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-agda/injections.scm +++ /dev/null @@ -1,17 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -((comment) @injection.content - (#set! injection.language "comment")) diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-bash/folds.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-bash/folds.scm deleted file mode 100644 index df0d617..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-bash/folds.scm +++ /dev/null @@ -1,24 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (function_definition) - (if_statement) - (case_statement) - (for_statement) - (while_statement) - (c_style_for_statement) - (heredoc_redirect) -] @fold diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-bash/injections.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-bash/injections.scm deleted file mode 100644 index fa96cd6..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-bash/injections.scm +++ /dev/null @@ -1,94 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -((comment) @injection.content - (#set! injection.language "comment")) - -((regex) @injection.content - (#set! injection.language "regex")) - -((heredoc_redirect - (heredoc_body) @injection.content - (heredoc_end) @injection.language) - (#downcase! @injection.language)) - -; printf 'format' -((command - name: (command_name) @_command - . - argument: [ - (string) @injection.content - (concatenation - (string) @injection.content) - (raw_string) @injection.content - (concatenation - (raw_string) @injection.content) - ]) - (#eq? @_command "printf") - (#offset! @injection.content 0 1 0 -1) - (#set! injection.include-children) - (#set! injection.language "printf")) - -; printf -v var 'format' -((command - name: (command_name) @_command - argument: (word) @_arg - . - (_) - . - argument: [ - (string) @injection.content - (concatenation - (string) @injection.content) - (raw_string) @injection.content - (concatenation - (raw_string) @injection.content) - ]) - (#eq? @_command "printf") - (#eq? @_arg "-v") - (#offset! @injection.content 0 1 0 -1) - (#set! injection.include-children) - (#set! injection.language "printf")) - -; printf -- 'format' -((command - name: (command_name) @_command - argument: (word) @_arg - . - argument: [ - (string) @injection.content - (concatenation - (string) @injection.content) - (raw_string) @injection.content - (concatenation - (raw_string) @injection.content) - ]) - (#eq? @_command "printf") - (#eq? @_arg "--") - (#offset! @injection.content 0 1 0 -1) - (#set! injection.include-children) - (#set! injection.language "printf")) - -((command - name: (command_name) @_command - . - argument: [ - (string) - (raw_string) - ] @injection.content) - (#eq? @_command "bind") - (#offset! @injection.content 0 1 0 -1) - (#set! injection.include-children) - (#set! injection.language "readline")) diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-bash/locals.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-bash/locals.scm deleted file mode 100644 index 49d9876..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-bash/locals.scm +++ /dev/null @@ -1,29 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -; Scopes -(function_definition) @local.scope - -; Definitions -(variable_assignment - name: (variable_name) @local.definition.var) - -(function_definition - name: (word) @local.definition.function) - -; References -(variable_name) @local.reference - -(word) @local.reference diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-c-sharp/folds.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-c-sharp/folds.scm deleted file mode 100644 index c323c5b..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-c-sharp/folds.scm +++ /dev/null @@ -1,32 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -body: [ - (declaration_list) - (switch_body) - (enum_member_declaration_list) -] @fold - -accessors: (accessor_list) @fold - -initializer: (initializer_expression) @fold - -[ - (block) - (preproc_if) - (preproc_elif) - (preproc_else) - (using_directive)+ -] @fold diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-c-sharp/injections.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-c-sharp/injections.scm deleted file mode 100644 index 3c59e7b..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-c-sharp/injections.scm +++ /dev/null @@ -1,17 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -((comment) @injection.content - (#set! injection.language "comment")) diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-c-sharp/locals.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-c-sharp/locals.scm deleted file mode 100644 index 11d5b5c..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-c-sharp/locals.scm +++ /dev/null @@ -1,57 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -; Definitions -(variable_declarator - . - (identifier) @local.definition.var) - -(variable_declarator - (tuple_pattern - (identifier) @local.definition.var)) - -(declaration_expression - name: (identifier) @local.definition.var) - -(foreach_statement - left: (identifier) @local.definition.var) - -(foreach_statement - left: (tuple_pattern - (identifier) @local.definition.var)) - -(parameter - (identifier) @local.definition.parameter) - -(method_declaration - name: (identifier) @local.definition.method) - -(local_function_statement - name: (identifier) @local.definition.method) - -(property_declaration - name: (identifier) @local.definition) - -(type_parameter - (identifier) @local.definition.type) - -(class_declaration - name: (identifier) @local.definition) - -; References -(identifier) @local.reference - -; Scope -(block) @local.scope diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-c/folds.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-c/folds.scm deleted file mode 100644 index 1d4063f..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-c/folds.scm +++ /dev/null @@ -1,38 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (for_statement) - (if_statement) - (while_statement) - (do_statement) - (switch_statement) - (case_statement) - (function_definition) - (struct_specifier) - (enum_specifier) - (comment) - (preproc_if) - (preproc_elif) - (preproc_else) - (preproc_ifdef) - (preproc_function_def) - (initializer_list) - (gnu_asm_expression) - (preproc_include)+ -] @fold - -(compound_statement - (compound_statement) @fold) diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-c/indents.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-c/indents.scm deleted file mode 100644 index c7d72ec..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-c/indents.scm +++ /dev/null @@ -1,114 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (compound_statement) - (field_declaration_list) - (case_statement) - (enumerator_list) - (compound_literal_expression) - (initializer_list) - (init_declarator) -] @indent.begin - -; With current indent logic, if we capture expression_statement with @indent.begin -; It will be affected by _parent_ node with error subnodes deep down the tree -; So narrow indent capture to check for error inside expression statement only, -(expression_statement - (_) @indent.begin - ";" @indent.end) - -(ERROR - "for" - "(" @indent.begin - ";" - ";" - ")" @indent.end) - -((for_statement - body: (_) @_body) @indent.begin - (#not-kind-eq? @_body "compound_statement")) - -(while_statement - condition: (_) @indent.begin) - -((while_statement - body: (_) @_body) @indent.begin - (#not-kind-eq? @_body "compound_statement")) - -((if_statement) - . - (ERROR - "else" @indent.begin)) - -(if_statement - condition: (_) @indent.begin) - -; Supports if without braces (but not both if-else without braces) -(if_statement - consequence: (_ - ";" @indent.end) @_consequence - (#not-kind-eq? @_consequence "compound_statement") - alternative: (else_clause - "else" @indent.branch - [ - (if_statement - (compound_statement) @indent.dedent)? @indent.dedent - (compound_statement)? @indent.dedent - (_)? @indent.dedent - ])?) @indent.begin - -(else_clause - (_ - . - "{" @indent.branch)) - -(compound_statement - "}" @indent.end) - -[ - ")" - "}" - (statement_identifier) -] @indent.branch - -[ - "#define" - "#ifdef" - "#ifndef" - "#elif" - "#if" - "#else" - "#endif" -] @indent.zero - -[ - (preproc_arg) - (string_literal) -] @indent.ignore - -((ERROR - (parameter_declaration)) @indent.align - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")")) - -([ - (argument_list) - (parameter_list) -] @indent.align - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")")) - -(comment) @indent.auto diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-c/injections.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-c/injections.scm deleted file mode 100644 index efc7155..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-c/injections.scm +++ /dev/null @@ -1,143 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -((preproc_arg) @injection.content - (#set! injection.language "c")) - -((comment) @injection.content - (#set! injection.language "comment")) - -((comment) @injection.content - (#match? @injection.content "/\\*!([a-zA-Z]+:)?re2c") - (#set! injection.language "re2c")) - -((comment) @injection.content - (#lua-match? @injection.content "/[*\/][!*\/] -(type_parameter_declaration - (type_identifier) @local.definition.type) - -(template_declaration) @local.scope - -; Namespaces -(namespace_definition - name: (namespace_identifier) @local.definition.namespace - body: (_) @local.scope) - -(namespace_definition - name: (nested_namespace_specifier) @local.definition.namespace - body: (_) @local.scope) - -((namespace_identifier) @local.reference - (#set! reference.kind "namespace")) - -; Function definitions -(template_function - name: (identifier) @local.definition.function) @local.scope - -(template_method - name: (field_identifier) @local.definition.method) @local.scope - -(function_declarator - declarator: (qualified_identifier - name: (identifier) @local.definition.function)) @local.scope - -(field_declaration - declarator: (function_declarator - (field_identifier) @local.definition.method)) - -(lambda_expression) @local.scope - -; Control structures -(try_statement - body: (_) @local.scope) - -(catch_clause) @local.scope - -(requires_expression) @local.scope diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-css/folds.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-css/folds.scm deleted file mode 100644 index f7a8cef..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-css/folds.scm +++ /dev/null @@ -1,25 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - ; top-level block statements from https://github.com/tree-sitter/tree-sitter-css/blob/master/grammar.js - ; note: (block) is not used due to unideal behavior when node before block node spans multiple lines - (rule_set) - (at_rule) - (supports_statement) - (media_statement) - (keyframe_block) - (import_statement)+ -] @fold diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-css/indents.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-css/indents.scm deleted file mode 100644 index 1d59783..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-css/indents.scm +++ /dev/null @@ -1,26 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (block) - (declaration) -] @indent.begin - -(block - "}" @indent.branch) - -"}" @indent.dedent - -(comment) @indent.ignore diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-css/injections.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-css/injections.scm deleted file mode 100644 index 3c59e7b..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-css/injections.scm +++ /dev/null @@ -1,17 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -((comment) @injection.content - (#set! injection.language "comment")) diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-dart/folds.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-dart/folds.scm deleted file mode 100644 index 93d54d2..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-dart/folds.scm +++ /dev/null @@ -1,28 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (class_definition) - (enum_declaration) - (extension_declaration) - (arguments) - (function_body) - (block) - (switch_block) - (list_literal) - (set_or_map_literal) - (string_literal) - (import_or_export)+ -] @fold diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-dart/indents.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-dart/indents.scm deleted file mode 100644 index 51e9958..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-dart/indents.scm +++ /dev/null @@ -1,64 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (class_body) - (function_body) - (function_expression_body) - (declaration - (initializers)) - (switch_block) - (formal_parameter_list) - (formal_parameter) - (list_literal) - (return_statement) - (arguments) - (try_statement) -] @indent.begin - -(switch_block - (_) @indent.begin - (#set! indent.immediate 1) - (#set! indent.start_at_same_line 1)) - -[ - (switch_statement_case) - (switch_statement_default) -] @indent.branch - -[ - "(" - ")" - "{" - "}" - "[" - "]" -] @indent.branch - -"}" @indent.end - -(return_statement - ";" @indent.end) - -(break_statement - ";" @indent.end) - -(comment) @indent.ignore - -; dedenting the else block is painfully slow; replace with simpler strategy -; (if_statement) @indent.begin -; (if_statement -; (block) @indent.branch) -(if_statement) @indent.auto diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-dart/injections.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-dart/injections.scm deleted file mode 100644 index 3c59e7b..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-dart/injections.scm +++ /dev/null @@ -1,17 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -((comment) @injection.content - (#set! injection.language "comment")) diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-dart/locals.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-dart/locals.scm deleted file mode 100644 index c2ae1db..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-dart/locals.scm +++ /dev/null @@ -1,47 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -; Definitions -(function_signature - name: (identifier) @local.definition.function) - -(formal_parameter - name: (identifier) @local.definition.parameter) - -(initialized_variable_definition - name: (identifier) @local.definition.var) - -(initialized_identifier - (identifier) @local.definition.var) - -(static_final_declaration - (identifier) @local.definition.var) - -; References -(identifier) @local.reference - -; Scopes -(class_definition - body: (_) @local.scope) - -[ - (block) - (if_statement) - (for_statement) - (while_statement) - (try_statement) - (catch_clause) - (finally_clause) -] @local.scope diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-dockerfile/injections.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-dockerfile/injections.scm deleted file mode 100644 index eb77383..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-dockerfile/injections.scm +++ /dev/null @@ -1,27 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -((comment) @injection.content - (#set! injection.language "comment")) - -((shell_command - (shell_fragment) @injection.content) - (#set! injection.language "bash") - (#set! injection.combined)) - -((run_instruction - (heredoc_block) @injection.content) - (#set! injection.language "bash") - (#set! injection.include-children)) diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-elixir/folds.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-elixir/folds.scm deleted file mode 100644 index 1c6c419..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-elixir/folds.scm +++ /dev/null @@ -1,25 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (anonymous_function) - (stab_clause) - (arguments) - (block) - (do_block) - (list) - (map) - (tuple) -] @fold diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-elixir/indents.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-elixir/indents.scm deleted file mode 100644 index cfcebcf..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-elixir/indents.scm +++ /dev/null @@ -1,40 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (block) - (do_block) - (list) - (map) - (stab_clause) - (tuple) - (arguments) -] @indent.begin - -[ - ")" - "]" - "after" - "catch" - "else" - "rescue" - "}" - "end" -] @indent.end @indent.branch - -; Elixir pipelines are not indented, but other binary operator chains are -((binary_operator - operator: _ @_operator) @indent.begin - (#not-eq? @_operator "|>")) diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-elixir/locals.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-elixir/locals.scm deleted file mode 100644 index a1e61dd..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-elixir/locals.scm +++ /dev/null @@ -1,215 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -; References -(identifier) @local.reference - -(alias) @local.reference - -; Module Definitions -(call - target: ((identifier) @_identifier - (#eq? @_identifier "defmodule")) - (arguments - (alias) @local.definition.type)) - -; Pattern Match Definitions -(binary_operator - ; format-ignore - left: - [ - (identifier) @local.definition.var - (_ (identifier) @local.definition.var) - (_ (_ (identifier) @local.definition.var)) - (_ (_ (_ (identifier) @local.definition.var))) - (_ (_ (_ (_ (identifier) @local.definition.var)))) - (_ (_ (_ (_ (_ (identifier) @local.definition.var))))) - (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))) - (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))))) - ] - operator: "=") - -; Stab Clause Definitions -; format-ignore -(stab_clause - left: - [ - (arguments - [ - (identifier) @local.definition.var - (_ (identifier) @local.definition.var) - (_ (_ (identifier) @local.definition.var)) - (_ (_ (_ (identifier) @local.definition.var))) - (_ (_ (_ (_ (identifier) @local.definition.var)))) - (_ (_ (_ (_ (_ (identifier) @local.definition.var))))) - (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))) - (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))))) - ]) - - (binary_operator - left: - (arguments - ; format-ignore - [ - (identifier) @local.definition.var - (_ (identifier) @local.definition.var) - (_ (_ (identifier) @local.definition.var)) - (_ (_ (_ (identifier) @local.definition.var))) - (_ (_ (_ (_ (identifier) @local.definition.var)))) - (_ (_ (_ (_ (_ (identifier) @local.definition.var))))) - (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))) - (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))))) - ]) - operator: "when") - ]) - -; Aliases -; format-ignore -(call - target: - ((identifier) @_identifier - (#any-of? @_identifier "require" "alias" "use" "import")) - (arguments - [ - (alias) @local.definition.import - (_ (alias) @local.definition.import) - (_ (_ (alias) @local.definition.import)) - (_ (_ (_ (alias) @local.definition.import))) - (_ (_ (_ (_ (alias) @local.definition.import)))) - ])) - -; Local Function Definitions & Scopes -; format-ignore -(call - target: - ((identifier) @_identifier - (#any-of? @_identifier "def" "defp" "defmacro" "defmacrop" "defguard" "defguardp" "defn" "defnp" "for")) - (arguments - [ - (identifier) @local.definition.function - (binary_operator - left: (identifier) @local.definition.function - operator: "when") - (binary_operator - (identifier) @local.definition.parameter) - (call - target: (identifier) @local.definition.function - (arguments - [ - (identifier) @local.definition.parameter - (_ (identifier) @local.definition.parameter) - (_ (_ (identifier) @local.definition.parameter)) - (_ (_ (_ (identifier) @local.definition.parameter))) - (_ (_ (_ (_ (identifier) @local.definition.parameter)))) - (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))) - (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))) - (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))))))) - ])) - ]?) - (#set! definition.function.scope parent)(do_block)?) @local.scope - -; ExUnit Test Definitions & Scopes -; format-ignore -(call - target: - ((identifier) @_identifier - (#eq? @_identifier "test")) - (arguments - [ - (string) - ((string) - . - "," - . - [ - (identifier) @local.definition.parameter - (_ (identifier) @local.definition.parameter) - (_ (_ (identifier) @local.definition.parameter)) - (_ (_ (_ (identifier) @local.definition.parameter))) - (_ (_ (_ (_ (identifier) @local.definition.parameter)))) - (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))) - (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))) - (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))))))) - ]) - ]) - (do_block)?) @local.scope - -; Stab Clause Scopes -(stab_clause) @local.scope diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-go/folds.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-go/folds.scm deleted file mode 100644 index f29e495..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-go/folds.scm +++ /dev/null @@ -1,34 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (const_declaration) - (expression_switch_statement) - (expression_case) - (default_case) - (type_switch_statement) - (type_case) - (for_statement) - (func_literal) - (function_declaration) - (if_statement) - (import_declaration) - (method_declaration) - (type_declaration) - (var_declaration) - (composite_literal) - (literal_element) - (block) -] @fold diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-go/indents.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-go/indents.scm deleted file mode 100644 index 1cca73f..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-go/indents.scm +++ /dev/null @@ -1,63 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (import_declaration) - (const_declaration) - (var_declaration) - (type_declaration) - (func_literal) - (literal_value) - (expression_case) - (communication_case) - (type_case) - (default_case) - (block) - (call_expression) - (parameter_list) - (field_declaration_list) - (interface_type) -] @indent.begin - -(literal_value - "}" @indent.branch) - -(block - "}" @indent.branch) - -(field_declaration_list - "}" @indent.branch) - -(interface_type - "}" @indent.branch) - -(const_declaration - ")" @indent.branch) - -(import_spec_list - ")" @indent.branch) - -(var_spec_list - ")" @indent.branch) - -[ - "}" - ")" -] @indent.end - -(parameter_list - ")" @indent.branch) - -(comment) @indent.ignore diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-go/injections.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-go/injections.scm deleted file mode 100644 index d8d0e1b..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-go/injections.scm +++ /dev/null @@ -1,57 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -((comment) @injection.content - (#set! injection.language "comment")) - -(call_expression - (selector_expression) @_function - (#any-of? @_function - "regexp.Match" "regexp.MatchReader" "regexp.MatchString" "regexp.Compile" "regexp.CompilePOSIX" - "regexp.MustCompile" "regexp.MustCompilePOSIX") - (argument_list - . - [ - (raw_string_literal - (raw_string_literal_content) @injection.content) - (interpreted_string_literal - (interpreted_string_literal_content) @injection.content) - ] - (#set! injection.language "regex"))) - -((comment) @injection.content - (#match? @injection.content "/\\*!([a-zA-Z]+:)?re2c") - (#set! injection.language "re2c")) - -((call_expression - function: (selector_expression - field: (field_identifier) @_method) - arguments: (argument_list - . - (interpreted_string_literal - (interpreted_string_literal_content) @injection.content))) - (#any-of? @_method "Printf" "Sprintf" "Fatalf" "Scanf" "Errorf" "Skipf" "Logf") - (#set! injection.language "printf")) - -((call_expression - function: (selector_expression - field: (field_identifier) @_method) - arguments: (argument_list - (_) - . - (interpreted_string_literal - (interpreted_string_literal_content) @injection.content))) - (#any-of? @_method "Fprintf" "Fscanf" "Appendf" "Sscanf") - (#set! injection.language "printf")) diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-go/locals.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-go/locals.scm deleted file mode 100644 index 99cfc85..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-go/locals.scm +++ /dev/null @@ -1,103 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -((function_declaration - name: (identifier) @local.definition.function) ; @function - ) - -((method_declaration - name: (field_identifier) @local.definition.method) ; @function.method - ) - -(short_var_declaration - left: (expression_list - (identifier) @local.definition.var)) - -(var_spec - name: (identifier) @local.definition.var) - -(parameter_declaration - (identifier) @local.definition.var) - -(variadic_parameter_declaration - (identifier) @local.definition.var) - -(for_statement - (range_clause - left: (expression_list - (identifier) @local.definition.var))) - -(const_declaration - (const_spec - name: (identifier) @local.definition.var)) - -(type_declaration - (type_spec - name: (type_identifier) @local.definition.type)) - -; reference -(identifier) @local.reference - -(type_identifier) @local.reference - -(field_identifier) @local.reference - -((package_identifier) @local.reference - (#set! reference.kind "namespace")) - -(package_clause - (package_identifier) @local.definition.namespace) - -(import_spec_list - (import_spec - name: (package_identifier) @local.definition.namespace)) - -; Call references -((call_expression - function: (identifier) @local.reference) - (#set! reference.kind "call")) - -((call_expression - function: (selector_expression - field: (field_identifier) @local.reference)) - (#set! reference.kind "call")) - -((call_expression - function: (parenthesized_expression - (identifier) @local.reference)) - (#set! reference.kind "call")) - -((call_expression - function: (parenthesized_expression - (selector_expression - field: (field_identifier) @local.reference))) - (#set! reference.kind "call")) - -; Scopes -(func_literal) @local.scope - -(source_file) @local.scope - -(function_declaration) @local.scope - -(if_statement) @local.scope - -(block) @local.scope - -(expression_switch_statement) @local.scope - -(for_statement) @local.scope - -(method_declaration) @local.scope diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-haskell/folds.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-haskell/folds.scm deleted file mode 100644 index d2416bd..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-haskell/folds.scm +++ /dev/null @@ -1,21 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (apply) - (do) - (function) - (import)+ -] @fold diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-haskell/injections.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-haskell/injections.scm deleted file mode 100644 index ec87c96..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-haskell/injections.scm +++ /dev/null @@ -1,99 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -; ----------------------------------------------------------------------------- -; General language injection -(quasiquote - (quoter) @injection.language - (quasiquote_body) @injection.content) - -((comment) @injection.content - (#set! injection.language "comment")) - -; ----------------------------------------------------------------------------- -; shakespeare library -; NOTE: doesn't support templating -; TODO: add once CoffeeScript parser is added -; ; CoffeeScript: Text.Coffee -; (quasiquote -; (quoter) @_name -; (#eq? @_name "coffee") -; ((quasiquote_body) @injection.content -; (#set! injection.language "coffeescript"))) -; CSS: Text.Cassius, Text.Lucius -(quasiquote - (quoter) @_name - (#any-of? @_name "cassius" "lucius") - (quasiquote_body) @injection.content - (#set! injection.language "css")) - -; HTML: Text.Hamlet -(quasiquote - (quoter) @_name - (#any-of? @_name "shamlet" "xshamlet" "hamlet" "xhamlet" "ihamlet") - (quasiquote_body) @injection.content - (#set! injection.language "html")) - -; JS: Text.Julius -(quasiquote - (quoter) @_name - (#any-of? @_name "js" "julius") - (quasiquote_body) @injection.content - (#set! injection.language "javascript")) - -; TS: Text.TypeScript -(quasiquote - (quoter) @_name - (#any-of? @_name "tsc" "tscJSX") - (quasiquote_body) @injection.content - (#set! injection.language "typescript")) - -; ----------------------------------------------------------------------------- -; HSX -(quasiquote - (quoter) @_name - (#eq? @_name "hsx") - (quasiquote_body) @injection.content - (#set! injection.language "html")) - -; ----------------------------------------------------------------------------- -; Inline JSON from aeson -(quasiquote - (quoter) @_name - (#eq? @_name "aesonQQ") - (quasiquote_body) @injection.content - (#set! injection.language "json")) - -; ----------------------------------------------------------------------------- -; SQL -; postgresql-simple -(quasiquote - (quoter) @injection.language - (#eq? @injection.language "sql") - (quasiquote_body) @injection.content) - -(quasiquote - (quoter) @_name - (#any-of? @_name "persistUpperCase" "persistLowerCase" "persistWith") - (quasiquote_body) @injection.content - (#set! injection.language "haskell_persistent")) - -; ----------------------------------------------------------------------------- -; Python -; inline-python -(quasiquote - (quoter) @injection.language - (#any-of? @injection.language "pymain" "pye" "py_" "pyf") - (quasiquote_body) @injection.content) diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-html/folds.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-html/folds.scm deleted file mode 100644 index f3eaa37..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-html/folds.scm +++ /dev/null @@ -1,20 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (element) - (style_element) - (script_element) -] @fold diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-html/indents.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-html/indents.scm deleted file mode 100644 index ccc3753..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-html/indents.scm +++ /dev/null @@ -1,16 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -; inherits: html_tags diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-html/locals.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-html/locals.scm deleted file mode 100644 index 10428a4..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-html/locals.scm +++ /dev/null @@ -1,16 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -(element) @local.scope diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-java/folds.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-java/folds.scm deleted file mode 100644 index 28c8220..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-java/folds.scm +++ /dev/null @@ -1,23 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (block) - (class_body) - (constructor_declaration) - (argument_list) - (annotation_argument_list) - (import_declaration)+ -] @fold diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-java/indents.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-java/indents.scm deleted file mode 100644 index 3ff8bbb..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-java/indents.scm +++ /dev/null @@ -1,55 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -; format-ignore -[ - ; ... refers to the portion that this indent query will have effects on - (class_body) ; { ... } of `class X` - (enum_body) ; { ... } of `enum X` - (interface_body) ; { ... } of `interface X` - (constructor_body) ; { `modifier` X() {...} } inside `class X` - (annotation_type_body) ; { ... } of `@interface X` - (block) ; { ... } that's not mentioned in this scope - (switch_block) ; { ... } in `switch X` - (array_initializer) ; [1, 2] - (argument_list) ; foo(...) - (formal_parameters) ; method foo(...) - (annotation_argument_list) ; @Annotation(...) - (element_value_array_initializer) ; { a, b } inside @Annotation() -] @indent.begin - -(expression_statement - (method_invocation) @indent.begin) - -[ - "(" - ")" - "{" - "}" - "[" - "]" -] @indent.branch - -(annotation_argument_list - ")" @indent.end) ; This should be a special cased as `()` here doesn't have ending `;` - -"}" @indent.end - -(line_comment) @indent.ignore - -[ - (ERROR) - (block_comment) -] @indent.auto diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-java/injections.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-java/injections.scm deleted file mode 100644 index 4ff41ad..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-java/injections.scm +++ /dev/null @@ -1,46 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -([ - (block_comment) - (line_comment) -] @injection.content - (#set! injection.language "comment")) - -((block_comment) @injection.content - (#lua-match? @injection.content "/[*][*][%s]") - (#set! injection.language "javadoc")) - -; markdown-style javadocs https://openjdk.org/jeps/467 -((line_comment) @injection.content - (#lua-match? @injection.content "^///%s") - (#set! injection.language "javadoc")) - -((method_invocation - name: (identifier) @_method - arguments: (argument_list - . - (string_literal - . - (_) @injection.content))) - (#any-of? @_method "format" "printf") - (#set! injection.language "printf")) - -((method_invocation - object: (string_literal - (string_fragment) @injection.content) - name: (identifier) @_method) - (#eq? @_method "formatted") - (#set! injection.language "printf")) diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-java/locals.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-java/locals.scm deleted file mode 100644 index a6b1dad..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-java/locals.scm +++ /dev/null @@ -1,115 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -; SCOPES -; declarations -(program) @local.scope - -(class_declaration - body: (_) @local.scope) - -(record_declaration - body: (_) @local.scope) - -(enum_declaration - body: (_) @local.scope) - -(lambda_expression) @local.scope - -(enhanced_for_statement) @local.scope - -; block -(block) @local.scope - -; if/else -(if_statement) @local.scope ; if+else - -(if_statement - consequence: (_) @local.scope) ; if body in case there are no braces - -(if_statement - alternative: (_) @local.scope) ; else body in case there are no braces - -; try/catch -(try_statement) @local.scope ; covers try+catch, individual try and catch are covered by (block) - -(catch_clause) @local.scope ; needed because `Exception` variable - -; loops -(for_statement) @local.scope ; whole for_statement because loop iterator variable - -(for_statement - ; "for" body in case there are no braces - body: (_) @local.scope) - -(do_statement - body: (_) @local.scope) - -(while_statement - body: (_) @local.scope) - -; Functions -(constructor_declaration) @local.scope - -(method_declaration) @local.scope - -; DEFINITIONS -(package_declaration - (identifier) @local.definition.namespace) - -(class_declaration - name: (identifier) @local.definition.type) - -(record_declaration - name: (identifier) @local.definition.type) - -(enum_declaration - name: (identifier) @local.definition.enum) - -(method_declaration - name: (identifier) @local.definition.method) - -(local_variable_declaration - declarator: (variable_declarator - name: (identifier) @local.definition.var)) - -(enhanced_for_statement - ; for (var item : items) { - name: (identifier) @local.definition.var) - -(formal_parameter - name: (identifier) @local.definition.parameter) - -(catch_formal_parameter - name: (identifier) @local.definition.parameter) - -(inferred_parameters - (identifier) @local.definition.parameter) ; (x,y) -> ... - -(lambda_expression - parameters: (identifier) @local.definition.parameter) ; x -> ... - -((scoped_identifier - (identifier) @local.definition.import) - (#has-ancestor? @local.definition.import import_declaration)) - -(field_declaration - declarator: (variable_declarator - name: (identifier) @local.definition.field)) - -; REFERENCES -(identifier) @local.reference - -(type_identifier) @local.reference diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-javascript/folds.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-javascript/folds.scm deleted file mode 100644 index e0aa637..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-javascript/folds.scm +++ /dev/null @@ -1,16 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -; inherits: ecma,jsx diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-javascript/indents.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-javascript/indents.scm deleted file mode 100644 index e0aa637..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-javascript/indents.scm +++ /dev/null @@ -1,16 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -; inherits: ecma,jsx diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-json/folds.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-json/folds.scm deleted file mode 100644 index e03f1ac..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-json/folds.scm +++ /dev/null @@ -1,20 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (pair) - (object) - (array) -] @fold diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-json/indents.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-json/indents.scm deleted file mode 100644 index c556fb3..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-json/indents.scm +++ /dev/null @@ -1,24 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (object) - (array) -] @indent.begin - -[ - "}" - "]" -] @indent.branch diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-json/locals.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-json/locals.scm deleted file mode 100644 index 305e30f..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-json/locals.scm +++ /dev/null @@ -1,19 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (object) - (array) -] @local.scope diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-julia/folds.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-julia/folds.scm deleted file mode 100644 index ad1e67e..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-julia/folds.scm +++ /dev/null @@ -1,29 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (module_definition) - (struct_definition) - (macro_definition) - (function_definition) - (if_statement) - (try_statement) - (for_statement) - (while_statement) - (let_statement) - (quote_statement) - (do_clause) - (compound_statement) -] @fold diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-julia/highlights.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-julia/highlights.scm deleted file mode 100644 index 0482b51..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-julia/highlights.scm +++ /dev/null @@ -1,387 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -; Identifiers -(identifier) @variable - -(field_expression - (identifier) @variable.member .) - -; Symbols -(quote_expression - ":" @string.special.symbol - [ - (identifier) - (operator) - ] @string.special.symbol) - -; Function calls -(call_expression - (identifier) @function.call) - -(call_expression - (field_expression - (identifier) @function.call .)) - -(broadcast_call_expression - (identifier) @function.call) - -(broadcast_call_expression - (field_expression - (identifier) @function.call .)) - -(binary_expression - (_) - (operator) @_pipe - (identifier) @function.call - (#any-of? @_pipe "|>" ".|>")) - -; Macros -(macro_identifier - "@" @function.macro - (identifier) @function.macro) - -(macro_definition - (signature - (call_expression - . - (identifier) @function.macro))) - -; Built-in functions -; filter(name -> Base.eval(Core, name) isa Core.Builtin, names(Core)) -((identifier) @function.builtin - (#any-of? @function.builtin - "applicable" "fieldtype" "getfield" "getglobal" "invoke" "isa" "isdefined" "modifyfield!" - "modifyglobal!" "nfields" "replacefield!" "replaceglobal!" "setfield!" "setfieldonce!" - "setglobal!" "setglobalonce!" "swapfield!" "swapglobal!" "throw" "tuple" "typeassert" "typeof")) - -; Type definitions -(type_head - (_) @type.definition) - -; Type annotations -(parametrized_type_expression - [ - (identifier) @type - (field_expression - (identifier) @type .) - ] - (curly_expression - (_) @type)) - -(typed_expression - (identifier) @type .) - -(unary_typed_expression - (identifier) @type .) - -(where_expression - [ - (curly_expression - (_) @type) - (_) @type - ] .) - -(unary_expression - (operator) @operator - (_) @type - (#any-of? @operator "<:" ">:")) - -(binary_expression - (_) @type - (operator) @operator - (_) @type - (#any-of? @operator "<:" ">:")) - -; Built-in types -; filter(name -> typeof(Base.eval(Core, name)) in [DataType, UnionAll], names(Core)) -((identifier) @type.builtin - (#any-of? @type.builtin - "AbstractArray" "AbstractChar" "AbstractFloat" "AbstractString" "Any" "ArgumentError" "Array" - "AssertionError" "Bool" "BoundsError" "Char" "ConcurrencyViolationError" "Cvoid" "DataType" - "DenseArray" "DivideError" "DomainError" "ErrorException" "Exception" "Expr" "Float16" "Float32" - "Float64" "Function" "GlobalRef" "IO" "InexactError" "InitError" "Int" "Int128" "Int16" "Int32" - "Int64" "Int8" "Integer" "InterruptException" "LineNumberNode" "LoadError" "Method" - "MethodError" "Module" "NTuple" "NamedTuple" "Nothing" "Number" "OutOfMemoryError" - "OverflowError" "Pair" "Ptr" "QuoteNode" "ReadOnlyMemoryError" "Real" "Ref" "SegmentationFault" - "Signed" "StackOverflowError" "String" "Symbol" "Task" "Tuple" "Type" "TypeError" "TypeVar" - "UInt" "UInt128" "UInt16" "UInt32" "UInt64" "UInt8" "UndefInitializer" "UndefKeywordError" - "UndefRefError" "UndefVarError" "Union" "UnionAll" "Unsigned" "VecElement" "WeakRef")) - -; Keywords -[ - "global" - "local" -] @keyword - -(compound_statement - [ - "begin" - "end" - ] @keyword) - -(quote_statement - [ - "quote" - "end" - ] @keyword) - -(let_statement - [ - "let" - "end" - ] @keyword) - -(if_statement - [ - "if" - "end" - ] @keyword.conditional) - -(elseif_clause - "elseif" @keyword.conditional) - -(else_clause - "else" @keyword.conditional) - -(ternary_expression - [ - "?" - ":" - ] @keyword.conditional.ternary) - -(try_statement - [ - "try" - "end" - ] @keyword.exception) - -(catch_clause - "catch" @keyword.exception) - -(finally_clause - "finally" @keyword.exception) - -(for_statement - [ - "for" - "end" - ] @keyword.repeat) - -(for_binding - "outer" @keyword.repeat) - -; comprehensions -(for_clause - "for" @keyword.repeat) - -(if_clause - "if" @keyword.conditional) - -(while_statement - [ - "while" - "end" - ] @keyword.repeat) - -[ - (break_statement) - (continue_statement) -] @keyword.repeat - -[ - "const" - "mutable" -] @keyword.modifier - -(function_definition - [ - "function" - "end" - ] @keyword.function) - -(do_clause - [ - "do" - "end" - ] @keyword.function) - -(macro_definition - [ - "macro" - "end" - ] @keyword) - -(return_statement - "return" @keyword.return) - -(module_definition - [ - "module" - "baremodule" - "end" - ] @keyword.import) - -(export_statement - "export" @keyword.import) - -(public_statement - "public" @keyword.import) - -(import_statement - "import" @keyword.import) - -(using_statement - "using" @keyword.import) - -(import_alias - "as" @keyword.import) - -(selected_import - ":" @punctuation.delimiter) - -(struct_definition - [ - "mutable" - "struct" - "end" - ] @keyword.type) - -(abstract_definition - [ - "abstract" - "type" - "end" - ] @keyword.type) - -(primitive_definition - [ - "primitive" - "type" - "end" - ] @keyword.type) - -; Operators & Punctuation -(operator) @operator - -(adjoint_expression - "'" @operator) - -(range_expression - ":" @operator) - -(arrow_function_expression - "->" @operator) - -[ - "." - "..." -] @punctuation.special - -[ - "," - ";" - "::" -] @punctuation.delimiter - -; Treat `::` as operator in type contexts, see -; https://github.com/nvim-treesitter/nvim-treesitter/pull/7392 -(typed_expression - "::" @operator) - -(unary_typed_expression - "::" @operator) - -[ - "(" - ")" - "[" - "]" - "{" - "}" -] @punctuation.bracket - -; Interpolation -(string_interpolation - . - "$" @punctuation.special) - -(interpolation_expression - . - "$" @punctuation.special) - -; Keyword operators -((operator) @keyword.operator - (#any-of? @keyword.operator "in" "isa")) - -(where_expression - "where" @keyword.operator) - -; Built-in constants -((identifier) @constant.builtin - (#any-of? @constant.builtin "nothing" "missing")) - -((identifier) @variable.builtin - (#any-of? @variable.builtin "begin" "end") - (#has-ancestor? @variable.builtin index_expression)) - -; Literals -(boolean_literal) @boolean - -(integer_literal) @number - -(float_literal) @number.float - -((identifier) @number.float - (#any-of? @number.float "NaN" "NaN16" "NaN32" "Inf" "Inf16" "Inf32")) - -(character_literal) @character - -(escape_sequence) @string.escape - -(string_literal) @string - -(prefixed_string_literal - prefix: (identifier) @function.macro) @string - -(command_literal) @string.special - -(prefixed_command_literal - prefix: (identifier) @function.macro) @string.special - -((string_literal) @string.documentation - . - [ - (abstract_definition) - (assignment) - (const_statement) - (function_definition) - (macro_definition) - (module_definition) - (struct_definition) - ]) - -(source_file - (string_literal) @string.documentation - . - [ - (identifier) - (call_expression) - ]) - -[ - (line_comment) - (block_comment) -] @comment @spell diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-julia/indents.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-julia/indents.scm deleted file mode 100644 index a510259..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-julia/indents.scm +++ /dev/null @@ -1,67 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (struct_definition) - (macro_definition) - (function_definition) - (compound_statement) - (if_statement) - (try_statement) - (for_statement) - (while_statement) - (let_statement) - (quote_statement) - (do_clause) - (assignment) - (for_binding) - (call_expression) - (parenthesized_expression) - (tuple_expression) - (comprehension_expression) - (matrix_expression) - (vector_expression) -] @indent.begin - -[ - "end" - ")" - "]" - "}" -] @indent.end - -[ - "end" - ")" - "]" - "}" - (else_clause) - (elseif_clause) - (catch_clause) - (finally_clause) -] @indent.branch - -[ - (line_comment) - (block_comment) -] @indent.ignore - -((argument_list) @indent.align - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")")) - -((curly_expression) @indent.align - (#set! indent.open_delimiter "{") - (#set! indent.close_delimiter "}")) diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-julia/injections.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-julia/injections.scm deleted file mode 100644 index 5d75928..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-julia/injections.scm +++ /dev/null @@ -1,57 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -; Inject markdown in docstrings -((string_literal - (content) @injection.content) - . - [ - (module_definition) - (abstract_definition) - (struct_definition) - (function_definition) - (macro_definition) - (assignment) - (const_statement) - (call_expression) - (identifier) - ] - (#set! injection.language "markdown")) - -; Inject comments -([ - (line_comment) - (block_comment) -] @injection.content - (#set! injection.language "comment")) - -; Inject regex in r"..." and r"""...""" (e.g. r"hello\bworld") -(prefixed_string_literal - prefix: (identifier) @_prefix - (content) @injection.content - (#eq? @_prefix "r") - (#set! injection.language "regex")) - -; Inject markdown in md"..." and md"""...""" (e.g. md"**Bold** and _Italics_") -(prefixed_string_literal - prefix: (identifier) @_prefix - (content) @injection.content - (#eq? @_prefix "md") - (#set! injection.language "markdown")) - -; Inject bash in `...` and ```...``` (e.g. `git add --help`) -(command_literal - (content) @injection.content - (#set! injection.language "bash")) diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-julia/locals.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-julia/locals.scm deleted file mode 100644 index df30a32..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-julia/locals.scm +++ /dev/null @@ -1,90 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -; References -(identifier) @local.reference - -; Variables -(assignment - (identifier) @local.definition.var) - -(assignment - (tuple_expression - (identifier) @local.definition.var)) - -; let/const bindings -(let_binding - (identifier) @local.definition.var) - -(let_binding - (tuple_expression - (identifier) @local.definition.var)) - -; For bindings -(for_binding - (identifier) @local.definition.var) - -(for_binding - (tuple_expression - (identifier) @local.definition.var)) - -; Types -(module_definition - (identifier) @local.definition.type) - -(struct_definition - (identifier) @local.definition.type) - -(type_head - (identifier) @local.definition.type) - -(type_head - (binary_expression - . - (identifier) @local.definition.type)) - -; Module imports -(import_statement - (identifier) @local.definition.import) - -(using_statement - (identifier) @local.definition.import) - -(selected_import - (identifier) @local.definition.import) - -; Scopes -(function_definition - (signature - (call_expression - . - (identifier) @local.definition.function))) @local.scope - -(macro_definition - (signature - (call_expression - . - (identifier) @local.definition.function))) @local.scope - -[ - (quote_statement) - (let_statement) - (for_statement) - (while_statement) - (try_statement) - (catch_clause) - (finally_clause) - (do_clause) -] @local.scope diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-kotlin/folds.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-kotlin/folds.scm deleted file mode 100644 index 068008d..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-kotlin/folds.scm +++ /dev/null @@ -1,28 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (import_list) - (when_expression) - (control_structure_body) - (lambda_literal) - (function_body) - (primary_constructor) - (secondary_constructor) - (anonymous_initializer) - (class_body) - (enum_class_body) - (interpolated_expression) -] @fold diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-kotlin/injections.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-kotlin/injections.scm deleted file mode 100644 index d17b2a0..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-kotlin/injections.scm +++ /dev/null @@ -1,63 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -([ - (line_comment) - (multiline_comment) -] @injection.content - (#set! injection.language "comment")) - -; There are 3 ways to define a regex -; - "[abc]?".toRegex() -(call_expression - (navigation_expression - ((string_literal) @injection.content - (#set! injection.language "regex")) - (navigation_suffix - ((simple_identifier) @_function - (#eq? @_function "toRegex"))))) - -; - Regex("[abc]?") -(call_expression - ((simple_identifier) @_function - (#eq? @_function "Regex")) - (call_suffix - (value_arguments - (value_argument - (string_literal) @injection.content - (#set! injection.language "regex"))))) - -; - Regex.fromLiteral("[abc]?") -(call_expression - (navigation_expression - ((simple_identifier) @_class - (#eq? @_class "Regex")) - (navigation_suffix - ((simple_identifier) @_function - (#eq? @_function "fromLiteral")))) - (call_suffix - (value_arguments - (value_argument - (string_literal) @injection.content - (#set! injection.language "regex"))))) - -; "pi = %.2f".format(3.14159) -((call_expression - (navigation_expression - (string_literal) @injection.content - (navigation_suffix - (simple_identifier) @_method))) - (#eq? @_method "format") - (#set! injection.language "printf")) diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-kotlin/locals.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-kotlin/locals.scm deleted file mode 100644 index 7cc9984..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-kotlin/locals.scm +++ /dev/null @@ -1,93 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -; Imports -(package_header - . - (identifier) @local.definition.namespace) - -(import_header - (identifier - (simple_identifier) @local.definition.import .) - (import_alias - (type_identifier) @local.definition.import)?) - -; Functions -(function_declaration - . - (simple_identifier) @local.definition.function - (#set! definition.function.scope "parent")) - -(class_body - (function_declaration - . - (simple_identifier) @local.definition.method) - (#set! definition.method.scope "parent")) - -; Variables -(function_declaration - (function_value_parameters - (parameter - (simple_identifier) @local.definition.parameter))) - -(lambda_literal - (lambda_parameters - (variable_declaration - (simple_identifier) @local.definition.parameter))) - -; NOTE: temporary fix for treesitter bug that causes delay in file opening -;(class_body -; (property_declaration -; (variable_declaration -; (simple_identifier) @local.definition.field))) -(class_declaration - (primary_constructor - (class_parameter - (simple_identifier) @local.definition.field))) - -(enum_class_body - (enum_entry - (simple_identifier) @local.definition.field)) - -(variable_declaration - (simple_identifier) @local.definition.var) - -; Types -(class_declaration - (type_identifier) @local.definition.type - (#set! definition.type.scope "parent")) - -(type_alias - (type_identifier) @local.definition.type - (#set! definition.type.scope "parent")) - -; Scopes -[ - (if_expression) - (when_expression) - (when_entry) - (for_statement) - (while_statement) - (do_while_statement) - (lambda_literal) - (function_declaration) - (primary_constructor) - (secondary_constructor) - (anonymous_initializer) - (class_declaration) - (enum_class_body) - (enum_entry) - (interpolated_expression) -] @local.scope diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-lua/folds.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-lua/folds.scm deleted file mode 100644 index 7eb3bb7..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-lua/folds.scm +++ /dev/null @@ -1,27 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (do_statement) - (while_statement) - (repeat_statement) - (if_statement) - (for_statement) - (function_declaration) - (function_definition) - (parameters) - (arguments) - (table_constructor) -] @fold diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-lua/indents.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-lua/indents.scm deleted file mode 100644 index 874178c..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-lua/indents.scm +++ /dev/null @@ -1,62 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (function_definition) - (function_declaration) - (field) - (do_statement) - (method_index_expression) - (while_statement) - (repeat_statement) - (if_statement) - "then" - (for_statement) - (return_statement) - (table_constructor) - (arguments) -] @indent.begin - -[ - "end" - "}" - "]]" -] @indent.end - -(")" @indent.end - (#not-has-parent? @indent.end parameters)) - -(return_statement - (expression_list - (function_call))) @indent.dedent - -[ - "end" - "then" - "until" - "}" - ")" - "elseif" - (elseif_statement) - "else" - (else_statement) -] @indent.branch - -(comment) @indent.auto - -(string) @indent.auto - -(ERROR - "function") @indent.begin diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-markdown/folds.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-markdown/folds.scm deleted file mode 100644 index 782f728..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-markdown/folds.scm +++ /dev/null @@ -1,27 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -([ - (fenced_code_block) - (indented_code_block) - (list_item - (list)) - (section) -] @fold - (#trim! @fold)) - -(section - (list) @fold - (#trim! @fold)) diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-markdown/indents.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-markdown/indents.scm deleted file mode 100644 index 871da9b..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-markdown/indents.scm +++ /dev/null @@ -1,16 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -(list_item) @indent.auto diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-ocaml/folds.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-ocaml/folds.scm deleted file mode 100644 index a03bf37..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-ocaml/folds.scm +++ /dev/null @@ -1,45 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (let_binding) - (external) - (type_binding) - (exception_definition) - (module_binding) - (module_type_definition) - (open_module) - (include_module) - (include_module_type) - (class_binding) - (class_type_binding) - (value_specification) - (inheritance_specification) - (instance_variable_specification) - (method_specification) - (inheritance_definition) - (instance_variable_definition) - (method_definition) - (class_initializer) - (match_case) - (attribute) - (item_attribute) - (floating_attribute) - (extension) - (item_extension) - (quoted_extension) - (quoted_item_extension) - (comment) -] @fold diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-ocaml/indents.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-ocaml/indents.scm deleted file mode 100644 index 4c23ce9..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-ocaml/indents.scm +++ /dev/null @@ -1,92 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -; format-ignore -[ - (let_binding) ; let = ... - (type_binding) - - (external) - (record_declaration) ; { foo: bar ... } - (structure) ; struct ... end - (signature) ; sig ... end - (value_specification) ; val x: bar - - (do_clause) ; do ... done - (match_case) - - (field_expression) - (application_expression) - (parenthesized_expression) ; ( ... ) - (record_expression) ; { foo = bar ... } - (list_expression) ; [...;...] - (try_expression) ; try ... with -] @indent.begin - -; handle if-else if-else case -(if_expression - condition: (_) @indent.begin) - -(then_clause) @indent.begin - -((else_clause - (_) @_not_if) @indent.begin - (#not-kind-eq? @_not_if "if_expression")) - -((parameter) @indent.begin - (#set! indent.start_at_same_line)) - -(_ - (ERROR) @indent.begin - (#set! indent.start_at_same_line)) - -(ERROR - "|" @indent.begin - (#set! indent.start_at_same_line)) - -(try_expression - "with" @indent.branch - [ - (match_case) @indent.dedent - (match_case - [ - (parenthesized_expression) - (list_expression) - ] @indent.dedent) - ]) - -"}" @indent.branch @indent.end - -(list_expression - "]" @indent.branch) - -(parenthesized_expression - ")" @indent.branch) - -";;" @indent.end - -(do_clause - "done" @indent.end @indent.branch) - -(structure - "end" @indent.end @indent.branch) - -(signature - "end" @indent.end @indent.branch) - -[ - (string) - (comment) -] @indent.auto diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-ocaml/injections.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-ocaml/injections.scm deleted file mode 100644 index 3c59e7b..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-ocaml/injections.scm +++ /dev/null @@ -1,17 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -((comment) @injection.content - (#set! injection.language "comment")) diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-perl/folds.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-perl/folds.scm deleted file mode 100644 index 776bb7f..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-perl/folds.scm +++ /dev/null @@ -1,51 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -(comment)+ @fold - -(pod) @fold - -; fold the block-typed package and class statements only -(package_statement - (block)) @fold - -(class_statement - (block)) @fold - -[ - (subroutine_declaration_statement) - (method_declaration_statement) - (conditional_statement) - (loop_statement) - (for_statement) - (cstyle_for_statement) - (block_statement) - (defer_statement) - (phaser_statement) -] @fold - -(try_statement - (block) @fold) - -(eval_expression - (block) @fold) - -(anonymous_subroutine_expression) @fold - -; perhaps folks want to fold these too? -[ - (anonymous_array_expression) - (anonymous_hash_expression) -] @fold diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-perl/highlights.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-perl/highlights.scm deleted file mode 100644 index 295c14c..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-perl/highlights.scm +++ /dev/null @@ -1,339 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -((source_file - . - (comment) @keyword.directive @nospell) - (#lua-match? @keyword.directive "^#!/")) - -[ - "use" - "no" - "require" -] @keyword.import - -[ - "if" - "elsif" - "unless" - "else" -] @keyword.conditional - -(conditional_expression - [ - "?" - ":" - ] @keyword.conditional.ternary) - -[ - "while" - "until" - "for" - "foreach" -] @keyword.repeat - -("continue" @keyword.repeat - (block)) - -[ - "try" - "catch" - "finally" -] @keyword.exception - -"return" @keyword.return - -[ - "sub" - "method" -] @keyword.function - -[ - "async" - "await" -] @keyword.coroutine - -[ - "map" - "grep" - "sort" -] @function.builtin - -[ - "package" - "class" - "role" -] @keyword.import - -[ - "defer" - "do" - "eval" - "my" - "our" - "local" - "dynamically" - "state" - "field" - "last" - "next" - "redo" - "goto" - "undef" -] @keyword - -(_ - operator: _ @operator) - -"\\" @operator - -(yadayada) @keyword.exception - -(phaser_statement - phase: _ @keyword) - -(class_phaser_statement - phase: _ @keyword) - -[ - "or" - "xor" - "and" - "eq" - "equ" - "eqr" - "ne" - "cmp" - "lt" - "le" - "ge" - "gt" - "isa" -] @keyword.operator - -(eof_marker) @keyword.directive - -(data_section) @comment - -(pod) @none - -[ - (number) - (version) -] @number - -(boolean) @boolean - -[ - (string_literal) - (interpolated_string_literal) - (quoted_word_list) - (command_string) - (heredoc_content) - (replacement) - (transliteration_content) -] @string - -[ - (heredoc_token) - (command_heredoc_token) - (heredoc_end) -] @label - -[ - (escape_sequence) - (escaped_delimiter) -] @string.escape - -(_ - modifiers: _ @character.special) - -[ - (quoted_regexp) - (match_regexp) - (regexp_content) -] @string.regexp - -(autoquoted_bareword) @string.special - -(use_statement - (package) @type) - -(package_statement - (package) @type) - -(class_statement - (package) @type) - -(require_expression - (bareword) @type) - -(subroutine_declaration_statement - name: (bareword) @function) - -(method_declaration_statement - name: (bareword) @function) - -(attribute_name) @attribute - -(attribute_value) @string - -(label) @label - -(statement_label - label: _ @label) - -(relational_expression - operator: "isa" - right: (bareword) @type) - -(function_call_expression - (function) @function.call) - -(method_call_expression - (method) @function.method.call) - -(method_call_expression - invocant: (bareword) @type) - -(func0op_call_expression - function: _ @function.builtin) - -(func1op_call_expression - function: _ @function.builtin) - -; this was a regex for the CLI -([ - (function) - (expression_statement - (bareword)) -] @function.builtin - (#any-of? @function.builtin - "accept" "atan2" "bind" "binmode" "bless" "crypt" "chmod" "chown" "connect" "die" "dbmopen" - "exec" "fcntl" "flock" "formline" "getpriority" "getprotobynumber" "gethostbyaddr" - "getnetbyaddr" "getservbyname" "getservbyport" "getsockopt" "glob" "index" "ioctl" "join" "kill" - "link" "listen" "mkdir" "msgctl" "msgget" "msgrcv" "msgsend" "open" "opendir" "print" "printf" - "push" "pack" "pipe" "return" "rename" "rindex" "read" "recv" "reverse" "say" "select" "seek" - "semctl" "semget" "semop" "send" "setpgrp" "setpriority" "seekdir" "setsockopt" "shmctl" - "shmread" "shmwrite" "shutdown" "socket" "socketpair" "split" "sprintf" "splice" "substr" - "system" "symlink" "syscall" "sysopen" "sysseek" "sysread" "syswrite" "tie" "truncate" "unlink" - "unpack" "utime" "unshift" "vec" "warn" "waitpid")) - -(function) @function - -(_ - "{" @punctuation.special - (varname) - "}" @punctuation.special) - -(varname - (block - "{" @punctuation.special - "}" @punctuation.special)) - -([ - (varname) - (filehandle) -] @variable.builtin - (#any-of? @variable.builtin - "ENV" "ARGV" "INC" "ARGVOUT" "SIG" "STDIN" "STDOUT" "STDERR" "a" "b" "_")) - -((varname) @variable.builtin - ; highlights all the reserved ^ vars like ${^THINGS} - (#lua-match? @variable.builtin "%^")) - -((varname) @variable.builtin - ; highlights punc vars and also numeric only like $11 - (#lua-match? @variable.builtin "^%A+$")) - -[ - (scalar) - (array) - (hash) - (glob) - ; arraylen's sigil is kinda special b/c it's not a data type - (arraylen - "$#" @operator) -] @variable - -; all post deref sigils highlighted as operators, and the unrolly star is a special char -(postfix_deref - [ - "$" - "@" - "%" - "*" - "$#" - ] @operator - "*" @character.special) - -(slices - [ - arrayref: _ - hashref: _ - ] - [ - "@" - "%" - ] @operator) - -; except for subref deref, b/c that's actually a function call -(amper_deref_expression - [ - "&" - "*" - ] @function.call) - -; mark hash or glob keys that are any form of string in any form of access -(_ - "{" - [ - (autoquoted_bareword) - (_ - (string_content)) - ] @variable.member - "}") - -; mark stringies on the LHS of a fat comma as a hash key, b/c that's usually what it -; denotes somewhat -(_ - [ - (autoquoted_bareword) - (_ - (string_content)) - ] @variable.member - . - "=>" - (_)) - -(comment) @comment @spell - -[ - "=>" - "," - ";" - "->" -] @punctuation.delimiter - -([ - "[" - "]" - "{" - "}" - "(" - ")" -] @punctuation.bracket - ; priority hack so nvim + ts-cli behave the same - (#set! priority 90)) diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-perl/injections.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-perl/injections.scm deleted file mode 100644 index ee2cbc3..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-perl/injections.scm +++ /dev/null @@ -1,30 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -; an injections.scm file for nvim-treesitter -((comment) @injection.content - (#set! injection.language "comment")) - -((pod) @injection.content - (#set! injection.language "pod")) - -((substitution_regexp - (replacement) @injection.content - (substitution_regexp_modifiers) @_modifiers) - ; match if there's a single `e` in the modifiers list - (#lua-match? @_modifiers "e") - (#not-lua-match? @_modifiers "e.*e") - (#set! injection.language "perl") - (#set! injection.include-children)) diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-php/folds.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-php/folds.scm deleted file mode 100644 index 348a19d..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-php/folds.scm +++ /dev/null @@ -1,16 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -; inherits: php_only diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-php/indents.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-php/indents.scm deleted file mode 100644 index 348a19d..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-php/indents.scm +++ /dev/null @@ -1,16 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -; inherits: php_only diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-php/locals.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-php/locals.scm deleted file mode 100644 index 348a19d..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-php/locals.scm +++ /dev/null @@ -1,16 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -; inherits: php_only diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-python/folds.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-python/folds.scm deleted file mode 100644 index b66ac84..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-python/folds.scm +++ /dev/null @@ -1,43 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (function_definition) - (class_definition) - (while_statement) - (for_statement) - (if_statement) - (with_statement) - (try_statement) - (match_statement) - (import_from_statement) - (parameters) - (argument_list) - (parenthesized_expression) - (generator_expression) - (list_comprehension) - (set_comprehension) - (dictionary_comprehension) - (tuple) - (list) - (set) - (dictionary) - (string) -] @fold - -[ - (import_statement) - (import_from_statement) -]+ @fold diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-python/indents.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-python/indents.scm deleted file mode 100644 index 1f72330..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-python/indents.scm +++ /dev/null @@ -1,228 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (import_from_statement) - (generator_expression) - (list_comprehension) - (set_comprehension) - (dictionary_comprehension) - (tuple_pattern) - (list_pattern) - (binary_operator) - (lambda) - (concatenated_string) -] @indent.begin - -((list) @indent.align - (#set! indent.open_delimiter "[") - (#set! indent.close_delimiter "]")) - -((dictionary) @indent.align - (#set! indent.open_delimiter "{") - (#set! indent.close_delimiter "}")) - -((set) @indent.align - (#set! indent.open_delimiter "{") - (#set! indent.close_delimiter "}")) - -((parenthesized_expression) @indent.align - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")")) - -((for_statement) @indent.begin - (#set! indent.immediate 1)) - -((if_statement) @indent.begin - (#set! indent.immediate 1)) - -((while_statement) @indent.begin - (#set! indent.immediate 1)) - -((try_statement) @indent.begin - (#set! indent.immediate 1)) - -(ERROR - "try" - . - ":" - (#set! indent.immediate 1)) @indent.begin - -(ERROR - "try" - . - ":" - (ERROR - (block - (expression_statement - (identifier) @_except) @indent.branch)) - (#eq? @_except "except")) - -((function_definition) @indent.begin - (#set! indent.immediate 1)) - -((class_definition) @indent.begin - (#set! indent.immediate 1)) - -((with_statement) @indent.begin - (#set! indent.immediate 1)) - -((match_statement) @indent.begin - (#set! indent.immediate 1)) - -((case_clause) @indent.begin - (#set! indent.immediate 1)) - -; if (cond1 -; or cond2 -; or cond3): -; pass -; -(if_statement - condition: (parenthesized_expression) @indent.align - (#lua-match? @indent.align "^%([^\n]") - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")") - (#set! indent.avoid_last_matching_next 1)) - -; while ( -; cond1 -; or cond2 -; or cond3): -; pass -; -(while_statement - condition: (parenthesized_expression) @indent.align - (#lua-match? @indent.align "[^\n ]%)$") - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")") - (#set! indent.avoid_last_matching_next 1)) - -; if ( -; cond1 -; or cond2 -; or cond3): -; pass -; -(if_statement - condition: (parenthesized_expression) @indent.align - (#lua-match? @indent.align "[^\n ]%)$") - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")") - (#set! indent.avoid_last_matching_next 1)) - -(ERROR - "(" @indent.align - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")") - . - (_)) - -((argument_list) @indent.align - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")")) - -((parameters) @indent.align - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")")) - -((parameters) @indent.align - (#lua-match? @indent.align "[^\n ]%)$") - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")") - (#set! indent.avoid_last_matching_next 1)) - -((tuple) @indent.align - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")")) - -(ERROR - "[" @indent.align - (#set! indent.open_delimiter "[") - (#set! indent.close_delimiter "]") - . - (_)) - -(ERROR - "{" @indent.align - (#set! indent.open_delimiter "{") - (#set! indent.close_delimiter "}") - . - (_)) - -[ - (break_statement) - (continue_statement) -] @indent.dedent - -(ERROR - (_) @indent.branch - ":" - . - (#lua-match? @indent.branch "^else")) - -(ERROR - (_) @indent.branch @indent.dedent - ":" - . - (#lua-match? @indent.branch "^elif")) - -(generator_expression - ")" @indent.end) - -(list_comprehension - "]" @indent.end) - -(set_comprehension - "}" @indent.end) - -(dictionary_comprehension - "}" @indent.end) - -(tuple_pattern - ")" @indent.end) - -(list_pattern - "]" @indent.end) - -(return_statement - [ - (_) @indent.end - (_ - [ - (_) - ")" - "}" - "]" - ] @indent.end .) - (attribute - attribute: (_) @indent.end) - (call - arguments: (_ - ")" @indent.end)) - "return" @indent.end - ] .) - -[ - ")" - "]" - "}" - (elif_clause) - (else_clause) - (except_clause) - (finally_clause) -] @indent.branch - -(string) @indent.auto diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-python/injections.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-python/injections.scm deleted file mode 100644 index 577c6c4..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-python/injections.scm +++ /dev/null @@ -1,33 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -(call - function: (attribute - object: (identifier) @_re) - arguments: (argument_list - . - (string - (string_content) @injection.content)) - (#eq? @_re "re") - (#set! injection.language "regex")) - -((binary_operator - left: (string - (string_content) @injection.content) - operator: "%") - (#set! injection.language "printf")) - -((comment) @injection.content - (#set! injection.language "comment")) diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-python/locals.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-python/locals.scm deleted file mode 100644 index ad14e56..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-python/locals.scm +++ /dev/null @@ -1,139 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -; Program structure -(module) @local.scope - -(class_definition - body: (block - (expression_statement - (assignment - left: (identifier) @local.definition.field)))) @local.scope - -(class_definition - body: (block - (expression_statement - (assignment - left: (_ - (identifier) @local.definition.field))))) @local.scope - -; Imports -(aliased_import - alias: (identifier) @local.definition.import) @local.scope - -(import_statement - name: (dotted_name - (identifier) @local.definition.import)) @local.scope - -(import_from_statement - name: (dotted_name - (identifier) @local.definition.import)) @local.scope - -; Function with parameters, defines parameters -(parameters - (identifier) @local.definition.parameter) - -(default_parameter - (identifier) @local.definition.parameter) - -(typed_parameter - (identifier) @local.definition.parameter) - -(typed_default_parameter - (identifier) @local.definition.parameter) - -; *args parameter -(parameters - (list_splat_pattern - (identifier) @local.definition.parameter)) - -; **kwargs parameter -(parameters - (dictionary_splat_pattern - (identifier) @local.definition.parameter)) - -; Function defines function and scope -((function_definition - name: (identifier) @local.definition.function) @local.scope - (#set! definition.function.scope "parent")) - -((class_definition - name: (identifier) @local.definition.type) @local.scope - (#set! definition.type.scope "parent")) - -(class_definition - body: (block - (function_definition - name: (identifier) @local.definition.method))) - -; Loops -; not a scope! -(for_statement - left: (pattern_list - (identifier) @local.definition.var)) - -(for_statement - left: (tuple_pattern - (identifier) @local.definition.var)) - -(for_statement - left: (identifier) @local.definition.var) - -; not a scope! -;(while_statement) @local.scope -; for in list comprehension -(for_in_clause - left: (identifier) @local.definition.var) - -(for_in_clause - left: (tuple_pattern - (identifier) @local.definition.var)) - -(for_in_clause - left: (pattern_list - (identifier) @local.definition.var)) - -(dictionary_comprehension) @local.scope - -(list_comprehension) @local.scope - -(set_comprehension) @local.scope - -; Assignments -(assignment - left: (identifier) @local.definition.var) - -(assignment - left: (pattern_list - (identifier) @local.definition.var)) - -(assignment - left: (tuple_pattern - (identifier) @local.definition.var)) - -(assignment - left: (attribute - (identifier) - (identifier) @local.definition.field)) - -; Walrus operator x := 1 -(named_expression - (identifier) @local.definition.var) - -(as_pattern - alias: (as_pattern_target) @local.definition.var) - -; REFERENCES -(identifier) @local.reference diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-ruby/folds.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-ruby/folds.scm deleted file mode 100644 index 08ff964..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-ruby/folds.scm +++ /dev/null @@ -1,27 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (method) - (singleton_method) - (class) - (module) - (if) - (else) - (case) - (do_block) - (singleton_class) - (lambda) -] @fold diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-ruby/indents.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-ruby/indents.scm deleted file mode 100644 index 1f386a8..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-ruby/indents.scm +++ /dev/null @@ -1,58 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (class) - (singleton_class) - (method) - (singleton_method) - (module) - (call) - (if) - (block) - (do_block) - (hash) - (array) - (argument_list) - (case) - (while) - (until) - (for) - (begin) - (unless) - (assignment) - (parenthesized_statements) -] @indent.begin - -[ - "end" - ")" - "}" - "]" -] @indent.end - -[ - "end" - ")" - "}" - "]" - (when) - (elsif) - (else) - (rescue) - (ensure) -] @indent.branch - -(comment) @indent.ignore diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-ruby/injections.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-ruby/injections.scm deleted file mode 100644 index e4770ad..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-ruby/injections.scm +++ /dev/null @@ -1,38 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -((comment) @injection.content - (#set! injection.language "comment")) - -(heredoc_body - (heredoc_content) @injection.content - (heredoc_end) @injection.language - (#downcase! @injection.language)) - -(regex - (string_content) @injection.content - (#set! injection.language "regex")) - -((call - receiver: (identifier) @_receiver - method: (identifier) @_method - arguments: (argument_list - (pair - key: (hash_key_symbol) - value: (string - (string_content) @injection.content)))) - (#eq? @_receiver "binding") - (#any-of? @_method "b" "break") - (#set! injection.self)) diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-rust/folds.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-rust/folds.scm deleted file mode 100644 index 3af1e95..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-rust/folds.scm +++ /dev/null @@ -1,40 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (mod_item) - (foreign_mod_item) - (function_item) - (struct_item) - (trait_item) - (enum_item) - (impl_item) - (type_item) - (union_item) - (const_item) - (let_declaration) - (loop_expression) - (for_expression) - (while_expression) - (if_expression) - (match_expression) - (call_expression) - (array_expression) - (macro_definition) - (macro_invocation) - (attribute_item) - (block) - (use_declaration)+ -] @fold diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-rust/indents.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-rust/indents.scm deleted file mode 100644 index 7e6655e..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-rust/indents.scm +++ /dev/null @@ -1,132 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (mod_item) - (struct_item) - (enum_item) - (impl_item) - (struct_expression) - (struct_pattern) - (tuple_struct_pattern) - (tuple_expression) - (tuple_type) - (tuple_pattern) - (match_block) - (call_expression) - (assignment_expression) - (arguments) - (block) - (where_clause) - (use_list) - (array_expression) - (ordered_field_declaration_list) - (field_declaration_list) - (enum_variant_list) - (parameters) - (token_tree) - (token_repetition) - (macro_definition) -] @indent.begin - -; Typing in "(" inside macro definitions breaks the tree entirely -; Making macro_definition becoming errors -; Offset this by adding back one indent for start of macro rules -(ERROR - . - "macro_rules!" - [ - "(" - "{" - "[" - ] @indent.begin - (#set! indent.immediate) - (#set! indent.start_at_same_line)) - -(macro_definition - [ - ")" - "}" - "]" - ] @indent.end) - -(trait_item - body: (_) @indent.begin) - -(string_literal - (escape_sequence)) @indent.begin - -(block - "}" @indent.end) - -(enum_item - body: (enum_variant_list - "}" @indent.end)) - -(impl_item - body: (declaration_list - "}" @indent.end)) - -(match_expression - body: (match_block - "}" @indent.end)) - -(mod_item - body: (declaration_list - "}" @indent.end)) - -(struct_item - body: (field_declaration_list - "}" @indent.end)) - -(struct_expression - body: (field_initializer_list - "}" @indent.end)) - -(struct_pattern - "}" @indent.end) - -(tuple_struct_pattern - ")" @indent.end) - -(tuple_type - ")" @indent.end) - -(tuple_pattern - ")" @indent.end) - -(trait_item - body: (declaration_list - "}" @indent.end)) - -(impl_item - (where_clause) @indent.dedent) - -[ - "where" - ")" - "]" - "}" -] @indent.branch - -(impl_item - (declaration_list) @indent.branch) - -[ - (line_comment) - (string_literal) -] @indent.ignore - -(raw_string_literal) @indent.auto diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-rust/locals.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-rust/locals.scm deleted file mode 100644 index d98cee8..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-rust/locals.scm +++ /dev/null @@ -1,113 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -; Imports -(extern_crate_declaration - name: (identifier) @local.definition.import) - -(use_declaration - argument: (scoped_identifier - name: (identifier) @local.definition.import)) - -(use_as_clause - alias: (identifier) @local.definition.import) - -(use_list - (identifier) @local.definition.import) ; use std::process::{Child, Command, Stdio}; - -; Functions -(function_item - name: (identifier) @local.definition.function) - -(function_item - name: (identifier) @local.definition.method - parameters: (parameters - (self_parameter))) - -; Variables -(parameter - pattern: (identifier) @local.definition.var) - -(let_declaration - pattern: (identifier) @local.definition.var) - -(const_item - name: (identifier) @local.definition.var) - -(tuple_pattern - (identifier) @local.definition.var) - -(let_condition - pattern: (_ - (identifier) @local.definition.var)) - -(tuple_struct_pattern - (identifier) @local.definition.var) - -(closure_parameters - (identifier) @local.definition.var) - -(self_parameter - (self) @local.definition.var) - -(for_expression - pattern: (identifier) @local.definition.var) - -; Types -(struct_item - name: (type_identifier) @local.definition.type) - -(enum_item - name: (type_identifier) @local.definition.type) - -; Fields -(field_declaration - name: (field_identifier) @local.definition.field) - -(enum_variant - name: (identifier) @local.definition.field) - -; References -(identifier) @local.reference - -((type_identifier) @local.reference - (#set! reference.kind "type")) - -((field_identifier) @local.reference - (#set! reference.kind "field")) - -; Macros -(macro_definition - name: (identifier) @local.definition.macro) - -; Module -(mod_item - name: (identifier) @local.definition.namespace) - -; Scopes -[ - (block) - (function_item) - (closure_expression) - (while_expression) - (for_expression) - (loop_expression) - (if_expression) - (match_expression) - (match_arm) - (struct_item) - (enum_item) - (impl_item) -] @local.scope diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-scala/folds.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-scala/folds.scm deleted file mode 100644 index 48efe57..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-scala/folds.scm +++ /dev/null @@ -1,31 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -(call_expression - (block) @fold) - -[ - (class_definition) - (trait_definition) - (object_definition) - (function_definition) - (val_definition) - (import_declaration) - (while_expression) - (do_while_expression) - (for_expression) - (try_expression) - (match_expression) -] @fold diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-scala/injections.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-scala/injections.scm deleted file mode 100644 index 779f82f..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-scala/injections.scm +++ /dev/null @@ -1,20 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -((comment) @injection.content - (#set! injection.language "comment")) - -((block_comment) @injection.content - (#set! injection.language "comment")) diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-sql/folds.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-sql/folds.scm deleted file mode 100644 index 81ff524..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-sql/folds.scm +++ /dev/null @@ -1,16 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -(statement) @fold diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-sql/injections.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-sql/injections.scm deleted file mode 100644 index d914103..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-sql/injections.scm +++ /dev/null @@ -1,20 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -((comment) @injection.content - (#set! injection.language "comment")) - -((marginalia) @injection.content - (#set! injection.language "comment")) diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-swift/folds.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-swift/folds.scm deleted file mode 100644 index 42155df..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-swift/folds.scm +++ /dev/null @@ -1,50 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -; format-ignore -[ - (protocol_body) ; protocol Foo { ... } - (class_body) ; class Foo { ... } - (enum_class_body) ; enum Foo { ... } - (function_body) ; func Foo (...) {...} - (computed_property) ; { ... } - - (computed_getter) ; get { ... } - (computed_setter) ; set { ... } - - (do_statement) - (if_statement) - (for_statement) - (switch_statement) - (while_statement) - (guard_statement) - (switch_entry) - - (type_parameters) ; x - (tuple_type) ; (...) - (array_type) ; [String] - (dictionary_type) ; [Foo: Bar] - - (call_expression) ; callFunc(...) - (tuple_expression) ; ( foo + bar ) - (array_literal) ; [ foo, bar ] - (dictionary_literal) ; [ foo: bar, x: y ] - (lambda_literal) - (willset_didset_block) - (willset_clause) - (didset_clause) - - (import_declaration)+ -] @fold diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-swift/indents.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-swift/indents.scm deleted file mode 100644 index b6adcb6..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-swift/indents.scm +++ /dev/null @@ -1,137 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -; format-ignore -[ - ; ... refers to the section that will get affected by this indent.begin capture - (protocol_body) ; protocol Foo { ... } - (class_body) ; class Foo { ... } - (enum_class_body) ; enum Foo { ... } - (function_declaration) ; func Foo (...) {...} - (init_declaration) ; init(...) {...} - (deinit_declaration) ; deinit {...} - (computed_property) ; { ... } - (subscript_declaration) ; subscript Foo(...) { ... } - - (computed_getter) ; get { ... } - (computed_setter) ; set { ... } - - (assignment) ; a = b - - (control_transfer_statement) ; return ... - (for_statement) - (while_statement) - (repeat_while_statement) - (do_statement) - (if_statement) - (switch_statement) - (guard_statement) - - (type_parameters) ; x - (tuple_type) ; (...) - (array_type) ; [String] - (dictionary_type) ; [Foo: Bar] - - (call_expression) ; callFunc(...) - (tuple_expression) ; ( foo + bar ) - (array_literal) ; [ foo, bar ] - (dictionary_literal) ; [ foo: bar, x: y ] - (lambda_literal) - (willset_didset_block) - (willset_clause) - (didset_clause) -] @indent.begin - -(init_declaration) @indent.begin - -(init_declaration - [ - "init" - "(" - ] @indent.branch) - -; indentation for init parameters -(init_declaration - ")" @indent.branch @indent.end) - -(init_declaration - (parameter) @indent.begin - (#set! indent.immediate)) - -; @something(...) -(modifiers - (attribute) @indent.begin) - -(function_declaration - (modifiers - . - (attribute) - (_)* @indent.branch) - . - _ @indent.branch - (#not-kind-eq? @indent.branch "type_parameters" "parameter")) - -(ERROR - [ - "<" - "{" - "(" - "[" - ]) @indent.begin - -; if-elseif -(if_statement - (if_statement) @indent.dedent) - -; case Foo: -; default Foo: -; @attribute default Foo: -(switch_entry - . - _ @indent.branch) - -(function_declaration - ")" @indent.branch) - -(type_parameters - ">" @indent.branch @indent.end .) - -(tuple_expression - ")" @indent.branch @indent.end) - -(value_arguments - ")" @indent.branch @indent.end) - -(tuple_type - ")" @indent.branch @indent.end) - -(modifiers - (attribute - ")" @indent.branch @indent.end)) - -[ - "}" - "]" -] @indent.branch @indent.end - -[ - ; (ERROR) - (comment) - (multiline_comment) - (raw_str_part) - (multi_line_string_literal) -] @indent.auto - -(directive) @indent.ignore diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-swift/injections.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-swift/injections.scm deleted file mode 100644 index d4e0ae1..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-swift/injections.scm +++ /dev/null @@ -1,20 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -([ - (comment) - (multiline_comment) -] @injection.content - (#set! injection.language "comment")) diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-toml/folds.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-toml/folds.scm deleted file mode 100644 index 2fd2c24..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-toml/folds.scm +++ /dev/null @@ -1,20 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (table) - (array) - (table_array_element) -] @fold diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-toml/indents.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-toml/indents.scm deleted file mode 100644 index 5b0c669..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-toml/indents.scm +++ /dev/null @@ -1,26 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (array) - (inline_table) -] @indent.begin - -[ - "[" - "]" - "{" - "}" -] @indent.branch diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-toml/injections.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-toml/injections.scm deleted file mode 100644 index 3c59e7b..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-toml/injections.scm +++ /dev/null @@ -1,17 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -((comment) @injection.content - (#set! injection.language "comment")) diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-toml/locals.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-toml/locals.scm deleted file mode 100644 index cec9dcd..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-toml/locals.scm +++ /dev/null @@ -1,19 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (table) - (table_array_element) -] @local.scope diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-typescript/folds.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-typescript/folds.scm deleted file mode 100644 index 05280af..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-typescript/folds.scm +++ /dev/null @@ -1,23 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -; inherits: ecma - -[ - (interface_declaration) - (internal_module) - (type_alias_declaration) - (enum_declaration) -] @fold diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-typescript/indents.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-typescript/indents.scm deleted file mode 100644 index 7319c1c..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-typescript/indents.scm +++ /dev/null @@ -1,22 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -; inherits: ecma - -[ - (enum_declaration) - (interface_declaration) - (object_type) -] @indent.begin diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-typescript/injections.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-typescript/injections.scm deleted file mode 100644 index 01be7e3..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-typescript/injections.scm +++ /dev/null @@ -1,16 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -; inherits: ecma diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-verilog/folds.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-verilog/folds.scm deleted file mode 100644 index a393080..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-verilog/folds.scm +++ /dev/null @@ -1,38 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (seq_block) - (function_body_declaration) - (task_body_declaration) - (generate_block) - (always_construct) - (property_declaration) - (checker_declaration) - (class_declaration) - (config_declaration) - (covergroup_declaration) - (clocking_declaration) - (interface_declaration) - (module_declaration) - (package_declaration) - (module_instantiation) - (program_declaration) - (specify_block) - (generate_region) - (package_import_declaration) - (text_macro_definition) - (include_compiler_directive)+ -] @fold diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-verilog/highlights.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-verilog/highlights.scm deleted file mode 100644 index eceae24..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-verilog/highlights.scm +++ /dev/null @@ -1,620 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -; Keywords -[ - "begin" - "end" - "generate" - "endgenerate" - (module_keyword) - "endmodule" - "program" - "endprogram" - "package" - "endpackage" - "checker" - "endchecker" - "config" - "endconfig" - "pure" - "virtual" - "extends" - "implements" - "super" - (class_item_qualifier) - "parameter" - "localparam" - "defparam" - "assign" - "modport" - "fork" - "join" - "join_none" - "join_any" - "default" - "break" - "tagged" - "extern" - "alias" - "posedge" - "negedge" - "bind" - "expect" - "type" - "void" - "coverpoint" - "cross" - "nettype" - "export" - "force" - "release" - "timeunit" - "timeprecision" - "sequence" - "endsequence" - "property" - "endproperty" - "clocking" - "endclocking" - "covergroup" - "endgroup" - "specify" - "endspecify" - "primitive" - "endprimitive" - "wait" - "wait_order" - "const" - "constraint" - "unique" - "do" - "genvar" - "inside" - "rand" - "continue" - "randc" - "event" - "global" - "ref" - "initial" - "string" - (unique_priority) - (bins_keyword) - (always_keyword) -] @keyword - -[ - "class" - "endclass" - "interface" - "endinterface" - "enum" - "struct" - "union" - "typedef" -] @keyword.type - -[ - "function" - "endfunction" - "task" - "endtask" -] @keyword.function - -"return" @keyword.return - -[ - "for" - "foreach" - "repeat" - "forever" - "while" -] @keyword.repeat - -; for -(loop_generate_construct - (generate_block - [ - "begin" - "end" - ] @keyword.conditional)) - -; foreach -(loop_statement - (statement - (statement_item - (seq_block - [ - "begin" - "end" - ] @keyword.conditional)))) - -; repeat forever while -(loop_statement - (statement_or_null - (statement - (statement_item - (seq_block - [ - "begin" - "end" - ] @keyword.conditional))))) - -[ - "if" - "else" - "iff" - (case_keyword) - "endcase" -] @keyword.conditional - -[ - "=" - "-" - "+" - "/" - "*" - "^" - "&" - "|" - "&&" - "||" - "<=" - "==" - "!=" - "===" - "!==" - "-:" - "<" - ">" - ">=" - "%" - ">>" - "<<" - "|=" - "|=>" - "|->" - ">>>" - "<<<" - "->>" - "->" - "=>" - "*>" - ".*" - (unary_operator) - (inc_or_dec_operator) - (queue_dimension) -] @operator - -"#" @constructor - -[ - ";" - "::" - "," - "." - ":" -] @punctuation.delimiter - -(conditional_expression - [ - "?" - ":" - ] @keyword.conditional.ternary) - -[ - "[" - "]" - "(" - ")" - "{" - "}" - "'{" -] @punctuation.bracket - -[ - "or" - "and" -] @keyword.operator - -[ - "input" - "output" - "inout" - "signed" - "unsigned" - "assert" - "cover" - "assume" - "disable" - "automatic" - "static" - (dpi_function_import_property) - (dpi_task_import_property) -] @keyword.modifier - -[ - "include" - "import" - "directive_include" -] @keyword.import - -(comment) @comment @spell - -[ - "@" - (cycle_delay_range) - (delay_control) - (cycle_delay) - (attribute_instance) -] @attribute - -(attribute_instance - (attr_spec - (simple_identifier) @property)) - -[ - (integral_number) - (unbased_unsized_literal) - (fixed_point_number) - (unsigned_number) -] @number - -[ - (net_type) - (integer_vector_type) - (time_unit) - (integer_atom_type) - (non_integer_type) -] @type.builtin - -(data_type - (simple_identifier) @type.builtin) - -; variable -(list_of_variable_decl_assignments - (variable_decl_assignment - name: (simple_identifier) @variable)) - -(hierarchical_identifier - (simple_identifier) @variable) - -(tf_port_item - (simple_identifier) @variable) - -port_name: (simple_identifier) @variable - -(port - (simple_identifier) @variable) - -(list_of_port_identifiers - (simple_identifier) @variable) - -(net_lvalue - (simple_identifier) @variable) - -(sequence_port_item - (simple_identifier) @variable) - -(property_port_item - (simple_identifier) @variable) - -(net_decl_assignment - (simple_identifier) @variable) - -(ERROR - (simple_identifier) @variable) - -; variable.member -(hierarchical_identifier - (simple_identifier) - (simple_identifier) @variable.member) - -(select - (simple_identifier) @variable.member) - -(named_port_connection - port_name: (simple_identifier) @variable.member) - -(ordered_port_connection - (expression - (primary - (hierarchical_identifier - (simple_identifier) @variable.member)))) - -(coverage_option - (simple_identifier) @variable.member) - -; variable.builtin -(method_call_body - arguments: (list_of_arguments - (expression) @variable.builtin - (#any-of? @variable.builtin "this"))) - -(implicit_class_handle) @variable.builtin - -; variable.parameter -(named_parameter_assignment - (simple_identifier) @variable.parameter) - -(parameter_declaration - (list_of_param_assignments - (param_assignment - (simple_identifier) @variable.parameter))) - -(local_parameter_declaration - (list_of_param_assignments - (param_assignment - (simple_identifier) @variable.parameter))) - -; function builtin -[ - (simulation_control_task) - (system_tf_identifier) - (severity_system_task) - (randomize_call) - (array_or_queue_method_name) - "new" -] @function.builtin - -; declaration -(task_body_declaration - . - name: (simple_identifier) @function - (simple_identifier)? @label) - -(function_body_declaration - . - name: (simple_identifier) @function - (simple_identifier)? @label) - -(function_body_declaration - . - (data_type_or_void) - name: (simple_identifier) @function - (simple_identifier)? @label) - -(clocking_declaration - . - name: (simple_identifier) @constructor - (simple_identifier)? @label) - -(sequence_declaration - . - name: (simple_identifier) @constructor - (simple_identifier)? @label) - -(property_declaration - . - name: (simple_identifier) @constructor - (simple_identifier)? @label) - -(class_declaration - . - name: (simple_identifier) @constructor - (simple_identifier)? @label) - -(interface_class_declaration - . - name: (simple_identifier) @constructor - (simple_identifier)? @label) - -(covergroup_declaration - . - name: (simple_identifier) @constructor - (simple_identifier)? @label) - -(package_declaration - . - name: (simple_identifier) @constructor - (simple_identifier)? @label) - -(checker_declaration - . - name: (simple_identifier) @constructor - (simple_identifier)? @label) - -(interface_declaration - . - [ - (simple_identifier) @constructor - (interface_nonansi_header - (simple_identifier) @constructor) - (interface_ansi_header - (simple_identifier) @constructor) - ] - (simple_identifier)? @label) - -(module_declaration - . - [ - (simple_identifier) @constructor - (module_nonansi_header - (simple_identifier) @constructor) - (module_ansi_header - (simple_identifier) @constructor) - ] - (simple_identifier)? @label) - -(program_declaration - . - [ - (simple_identifier) @constructor - (program_nonansi_header - (simple_identifier) @constructor) - (program_ansi_header - (simple_identifier) @constructor) - ] - (simple_identifier)? @label) - -(generate_block - name: (simple_identifier) @label) - -; function.call -(method_call_body - name: (simple_identifier) @function.call) - -(tf_call - (hierarchical_identifier - (simple_identifier) @function.call)) - -; instance -(module_instantiation - instance_type: (simple_identifier) @constructor) - -(name_of_instance - instance_name: (simple_identifier) @module) - -(sequence_instance - (hierarchical_identifier - (simple_identifier) @module)) - -(udp_instantiation - (simple_identifier) @constructor) - -(ansi_port_declaration - (interface_port_header - interface_name: (simple_identifier) @variable - modport_name: (simple_identifier) @variable.member) - port_name: (simple_identifier) @variable) - -; bind -(bind_directive - (bind_target_scope - (simple_identifier) @constructor)) - -(bind_target_instance - (hierarchical_identifier - (simple_identifier) @module)) - -; assertion -(concurrent_assertion_item - (simple_identifier) @label) - -; converge -(cover_point - name: (simple_identifier) @label) - -(cover_cross - name: (simple_identifier) @module) - -(list_of_cross_items - (simple_identifier) @constructor) - -;package -(package_import_item - (simple_identifier) @constructor) - -; label -(seq_block - (simple_identifier) @label) - -(statement - block_name: (simple_identifier) @label) - -; dpi -(dpi_spec_string) @string - -c_name: (c_identifier) @function - -(dpi_import_export - name: (simple_identifier) @function) - -; type def -(class_type - (simple_identifier) @constructor) - -(class_type - (simple_identifier) - (simple_identifier) @type) - -(data_type - (class_scope - (class_type - (simple_identifier) @constructor))) - -(task_prototype - name: (simple_identifier) @function) - -(function_prototype - name: (simple_identifier) @function) - -(type_assignment - name: (simple_identifier) @type.definition) - -(interface_class_type - (simple_identifier) @type.definition) - -(package_scope - (simple_identifier) @constructor) - -(data_declaration - (type_declaration - type_name: (simple_identifier) @type.definition)) - -(net_declaration - (simple_identifier) @type) - -(constraint_declaration - (simple_identifier) @constructor) - -(method_call - (primary - (hierarchical_identifier - (simple_identifier) @constructor))) - -(string_literal - (quoted_string) @string) - -; include -(include_statement - (file_path_spec) @string.special.path) - -; directive -[ - "directive_define" - "directive_default_nettype" - "directive_resetall" - "directive_timescale" - "directive_undef" - "directive_undefineall" - "directive_ifdef" - "directive_ifndef" - "directive_elsif" - "directive_endif" - "directive_else" -] @keyword.directive.define - -(include_compiler_directive - (quoted_string) @string.special.path) - -(include_compiler_directive - (system_lib_string) @string) - -(default_nettype_compiler_directive - (default_nettype_value) @type.builtin) - -(text_macro_definition - (text_macro_name - (simple_identifier) @keyword.directive)) - -(text_macro_usage) @keyword.directive - -(ifdef_condition - (simple_identifier) @keyword.directive) - -(undefine_compiler_directive - (simple_identifier) @keyword.directive) diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-verilog/injections.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-verilog/injections.scm deleted file mode 100644 index 4a3ad32..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-verilog/injections.scm +++ /dev/null @@ -1,20 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -((comment) @injection.content - (#set! injection.language "comment")) - -((macro_text) @injection.content - (#set! injection.language "verilog")) diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-yaml/folds.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-yaml/folds.scm deleted file mode 100644 index 2892954..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-yaml/folds.scm +++ /dev/null @@ -1,19 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (block_mapping_pair) - (block_sequence_item) -] @fold diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-yaml/indents.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-yaml/indents.scm deleted file mode 100644 index 18af40e..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-yaml/indents.scm +++ /dev/null @@ -1,22 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (block_mapping_pair - value: (block_node)) - (block_sequence_item) -] @indent.begin - -(ERROR) @indent.auto diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-yaml/injections.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-yaml/injections.scm deleted file mode 100644 index 3961467..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-yaml/injections.scm +++ /dev/null @@ -1,96 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -((comment) @injection.content - (#set! injection.language "comment")) - -; Github actions ("run") / Gitlab CI ("scripts") -; Taskfile scripts ("cmds", "cmd", "sh") -(block_mapping_pair - key: (flow_node) @_run - (#any-of? @_run "run" "script" "before_script" "after_script" "cmds" "cmd" "sh") - value: (flow_node - (plain_scalar - (string_scalar) @injection.content) - (#set! injection.language "bash"))) - -(block_mapping_pair - key: (flow_node) @_run - (#any-of? @_run "run" "script" "before_script" "after_script" "cmds" "cmd" "sh") - value: (block_node - (block_scalar) @injection.content - (#set! injection.language "bash") - (#offset! @injection.content 0 1 0 0))) - -(block_mapping_pair - key: (flow_node) @_run - (#any-of? @_run "run" "script" "before_script" "after_script" "cmds" "sh") - value: (block_node - (block_sequence - (block_sequence_item - (flow_node - (plain_scalar - (string_scalar) @injection.content)) - (#set! injection.language "bash"))))) - -(block_mapping_pair - key: (flow_node) @_run - (#any-of? @_run "script" "before_script" "after_script" "cmds" "sh") - value: (block_node - (block_sequence - (block_sequence_item - (block_node - (block_scalar) @injection.content - (#set! injection.language "bash") - (#offset! @injection.content 0 1 0 0)))))) - -; Prometheus Alertmanager ("expr") -(block_mapping_pair - key: (flow_node) @_expr - (#eq? @_expr "expr") - value: (flow_node - (plain_scalar - (string_scalar) @injection.content) - (#set! injection.language "promql"))) - -(block_mapping_pair - key: (flow_node) @_expr - (#eq? @_expr "expr") - value: (block_node - (block_scalar) @injection.content - (#set! injection.language "promql") - (#offset! @injection.content 0 1 0 0))) - -(block_mapping_pair - key: (flow_node) @_expr - (#eq? @_expr "expr") - value: (block_node - (block_sequence - (block_sequence_item - (flow_node - (plain_scalar - (string_scalar) @injection.content)) - (#set! injection.language "promql"))))) - -(block_mapping_pair - key: (flow_node) @_expr - (#eq? @_expr "expr") - value: (block_node - (block_sequence - (block_sequence_item - (block_node - (block_scalar) @injection.content - (#set! injection.language "promql") - (#offset! @injection.content 0 1 0 0)))))) diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-yaml/locals.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-yaml/locals.scm deleted file mode 100644 index 7f9b666..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-yaml/locals.scm +++ /dev/null @@ -1,24 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -[ - (stream) - (document) - (block_node) -] @local.scope - -(anchor_name) @local.definition - -(alias_name) @local.reference diff --git a/Sources/CodeEditLanguages/Resources/tree-sitter-zig/locals.scm b/Sources/CodeEditLanguages/Resources/tree-sitter-zig/locals.scm deleted file mode 100644 index 3aa54d2..0000000 --- a/Sources/CodeEditLanguages/Resources/tree-sitter-zig/locals.scm +++ /dev/null @@ -1,111 +0,0 @@ -; Copyright 2025 nvim-treesitter -; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. - - -; Definitions -(function_declaration - name: (identifier) @local.definition.function) - -(parameter - name: (identifier) @local.definition.parameter) - -(variable_declaration - (identifier) @local.definition.var) - -(variable_declaration - (identifier) @local.definition.type - (enum_declaration)) - -(container_field - type: (identifier) @local.definition.field) - -(enum_declaration - (function_declaration - name: (identifier) @local.definition.method)) - -(variable_declaration - (identifier) @local.definition.type - (struct_declaration)) - -(struct_declaration - (function_declaration - name: (identifier) @local.definition.method)) - -(container_field - name: (identifier) @local.definition.field) - -(variable_declaration - (identifier) @local.definition.type - (union_declaration)) - -(union_declaration - (function_declaration - name: (identifier) @local.definition.method)) - -(payload - (identifier) @local.definition.var) - -(block_label - (identifier) @local.definition) - -; References -(identifier) @local.reference - -(parameter - type: (identifier) @local.reference - (#set! reference.kind "type")) - -(pointer_type - (identifier) @local.reference - (#set! reference.kind "type")) - -(nullable_type - (identifier) @local.reference - (#set! reference.kind "type")) - -(struct_initializer - (identifier) @local.reference - (#set! reference.kind "type")) - -(array_type - (_) - (identifier) @local.reference - (#set! reference.kind "type")) - -(slice_type - (identifier) @local.reference - (#set! reference.kind "type")) - -(field_expression - member: (identifier) @local.reference - (#set! reference.kind "field")) - -(call_expression - function: (field_expression - member: (identifier) @local.reference - (#set! reference.kind "function"))) - -(break_label - (identifier) @local.reference) - -[ - (for_statement) - (if_statement) - (while_statement) - (function_declaration) - (block) - (source_file) - (enum_declaration) - (struct_declaration) -] @local.scope diff --git a/Sources/CodeEditLanguages/TreeSitterLanguage.swift b/Sources/CodeEditLanguages/TreeSitterLanguage.swift index 850d4f4..8585afd 100644 --- a/Sources/CodeEditLanguages/TreeSitterLanguage.swift +++ b/Sources/CodeEditLanguages/TreeSitterLanguage.swift @@ -21,6 +21,7 @@ public enum TreeSitterLanguage: String { case go case goMod case haskell + case ini case html case java case javascript @@ -30,6 +31,7 @@ public enum TreeSitterLanguage: String { case julia case kotlin case lua + case make case markdown case markdownInline case objc @@ -37,7 +39,9 @@ public enum TreeSitterLanguage: String { case ocamlInterface case perl case php + case properties case python + case r case regex case ruby case rust @@ -48,6 +52,7 @@ public enum TreeSitterLanguage: String { case tsx case typescript case verilog + case xml case yaml case zig case plainText diff --git a/Sources/CodeEditLanguages/TreeSitterModel.swift b/Sources/CodeEditLanguages/TreeSitterModel.swift index 4ef8d58..8b607e3 100644 --- a/Sources/CodeEditLanguages/TreeSitterModel.swift +++ b/Sources/CodeEditLanguages/TreeSitterModel.swift @@ -44,6 +44,8 @@ public class TreeSitterModel { return goModQuery case .haskell: return haskellQuery + case .ini: + return iniQuery case .html: return htmlQuery case .java: @@ -62,6 +64,8 @@ public class TreeSitterModel { return kotlinQuery case .lua: return luaQuery + case .make: + return makeQuery case .markdown: return markdownQuery case .markdownInline: @@ -76,8 +80,12 @@ public class TreeSitterModel { return nil case .php: return phpQuery + case .properties: + return propertiesQuery case .python: return pythonQuery + case .r: + return rQuery case .regex: return regexQuery case .ruby: @@ -98,6 +106,8 @@ public class TreeSitterModel { return typescriptQuery case .verilog: return nil + case .xml: + return xmlQuery case .yaml: return yamlQuery case .zig: @@ -162,6 +172,11 @@ public class TreeSitterModel { return queryFor(.haskell) }() + /// Query for `INI` files. + public private(set) lazy var iniQuery: Query? = { + return queryFor(.ini) + }() + /// Query for `HTML` files. public private(set) lazy var htmlQuery: Query? = { return queryFor(.html) @@ -202,6 +217,11 @@ public class TreeSitterModel { return queryFor(.lua) }() + /// Query for `Makefile` files. + public private(set) lazy var makeQuery: Query? = { + return queryFor(.make) + }() + /// Query for `Markdown` files. public private(set) lazy var markdownQuery: Query? = { return queryFor(.markdown) @@ -232,11 +252,21 @@ public class TreeSitterModel { return queryFor(.php) }() + /// Query for `Properties` files. + public private(set) lazy var propertiesQuery: Query? = { + return queryFor(.properties) + }() + /// Query for `Python` files. public private(set) lazy var pythonQuery: Query? = { return queryFor(.python) }() + /// Query for `R` files. + public private(set) lazy var rQuery: Query? = { + return queryFor(.r) + }() + /// Query for `Regex` files. public private(set) lazy var regexQuery: Query? = { return queryFor(.regex) @@ -282,6 +312,11 @@ public class TreeSitterModel { return queryFor(.typescript) }() + /// Query for `XML` files. + public private(set) lazy var xmlQuery: Query? = { + return queryFor(.xml) + }() + /// Query for `YAML` files. public private(set) lazy var yamlQuery: Query? = { return queryFor(.yaml) diff --git a/Tests/CodeEditLanguagesTests/CodeEditLanguagesTests.swift b/Tests/CodeEditLanguagesTests/CodeEditLanguagesTests.swift index c2feda0..d36c342 100644 --- a/Tests/CodeEditLanguagesTests/CodeEditLanguagesTests.swift +++ b/Tests/CodeEditLanguagesTests/CodeEditLanguagesTests.swift @@ -259,6 +259,25 @@ final class CodeEditLanguagesTests: XCTestCase { XCTAssertNotEqual(query?.patternCount, 0) } +// MARK: - INI + + func test_CodeLanguageINI() throws { + let url = URL(fileURLWithPath: "~/path/to/file.ini") + let language = CodeLanguage.detectLanguageFrom(url: url) + + XCTAssertEqual(language.id, .ini) + } + + func test_FetchQueryINI() throws { + var language = CodeLanguage.ini + language.resourceURL = bundleURL + + let data = try Data(contentsOf: language.queryURL!) + let query = try? Query(language: language.language!, data: data) + XCTAssertNotNil(query) + XCTAssertNotEqual(query?.patternCount, 0) + } + // MARK: - HTML func test_CodeLanguageHTML() throws { @@ -440,6 +459,26 @@ final class CodeEditLanguagesTests: XCTestCase { XCTAssertNotNil(query) XCTAssertNotEqual(query?.patternCount, 0) } + +// MARK: - Makefile + + func test_CodeLanguageMake() throws { + let url = URL(fileURLWithPath: "~/path/to/Makefile") + let language = CodeLanguage.detectLanguageFrom(url: url) + + XCTAssertEqual(language.id, .make) + } + + func test_FetchQueryMake() throws { + var language = CodeLanguage.make + language.resourceURL = bundleURL + + let data = try Data(contentsOf: language.queryURL!) + let query = try? Query(language: language.language!, data: data) + XCTAssertNotNil(query) + XCTAssertNotEqual(query?.patternCount, 0) + } + // MARK: - Markdown func test_CodeLanguageMarkdown() throws { @@ -594,6 +633,32 @@ final class CodeEditLanguagesTests: XCTestCase { XCTAssertNotEqual(query?.patternCount, 0) } +// MARK: - Properties + + func test_CodeLanguageProperties() throws { + let url = URL(fileURLWithPath: "~/path/to/file.properties") + let language = CodeLanguage.detectLanguageFrom(url: url) + + XCTAssertEqual(language.id, .properties) + } + + func test_CodeLanguageEnv() throws { + let url = URL(fileURLWithPath: "~/path/to/.env") + let language = CodeLanguage.detectLanguageFrom(url: url) + + XCTAssertEqual(language.id, .properties) + } + + func test_FetchQueryProperties() throws { + var language = CodeLanguage.properties + language.resourceURL = bundleURL + + let data = try Data(contentsOf: language.queryURL!) + let query = try? Query(language: language.language!, data: data) + XCTAssertNotNil(query) + XCTAssertNotEqual(query?.patternCount, 0) + } + // MARK: - Python func test_CodeLanguagePython() throws { @@ -613,6 +678,32 @@ final class CodeEditLanguagesTests: XCTestCase { XCTAssertNotEqual(query?.patternCount, 0) } +// MARK: - R + + func test_CodeLanguageR() throws { + let url = URL(fileURLWithPath: "~/path/to/file.r") + let language = CodeLanguage.detectLanguageFrom(url: url) + + XCTAssertEqual(language.id, .r) + } + + func test_CodeLanguageR2() throws { + let url = URL(fileURLWithPath: "~/path/to/file.R") + let language = CodeLanguage.detectLanguageFrom(url: url) + + XCTAssertEqual(language.id, .r) + } + + func test_FetchQueryR() throws { + var language = CodeLanguage.r + language.resourceURL = bundleURL + + let data = try Data(contentsOf: language.queryURL!) + let query = try? Query(language: language.language!, data: data) + XCTAssertNotNil(query) + XCTAssertNotEqual(query?.patternCount, 0) + } + // MARK: - Ruby func test_CodeLanguageRuby() throws { @@ -782,6 +873,39 @@ final class CodeEditLanguagesTests: XCTestCase { XCTAssertEqual(language.id, .verilog) } +// MARK: - XML + + func test_CodeLanguageXML() throws { + let url = URL(fileURLWithPath: "~/path/to/file.xml") + let language = CodeLanguage.detectLanguageFrom(url: url) + + XCTAssertEqual(language.id, .xml) + } + + func test_CodeLanguageXML2() throws { + let url = URL(fileURLWithPath: "~/path/to/file.plist") + let language = CodeLanguage.detectLanguageFrom(url: url) + + XCTAssertEqual(language.id, .xml) + } + + func test_CodeLanguageXML3() throws { + let url = URL(fileURLWithPath: "~/path/to/file.svg") + let language = CodeLanguage.detectLanguageFrom(url: url) + + XCTAssertEqual(language.id, .xml) + } + + func test_FetchQueryXML() throws { + var language = CodeLanguage.xml + language.resourceURL = bundleURL + + let data = try Data(contentsOf: language.queryURL!) + let query = try? Query(language: language.language!, data: data) + XCTAssertNotNil(query) + XCTAssertNotEqual(query?.patternCount, 0) + } + // MARK: - YAML func test_CodeLanguageYAML() throws { diff --git a/build_framework.sh b/build_framework.sh index 82fa371..aef39d0 100755 --- a/build_framework.sh +++ b/build_framework.sh @@ -1,6 +1,6 @@ #!/usr/bin/env sh -# This script builds the CodeLanguagesContainer.xcframework +# This script builds the CodeLanguagesContainer.xcframework for macOS and iOS # # Just call it from the root of the project # $ ./build_framework.sh @@ -9,6 +9,7 @@ # $ ./build_framework.sh --debug # # Created by: Lukas Pistrol on 29.10.2022 +# Updated: Added iOS support # convenience function to print a status message in green status () { @@ -29,8 +30,39 @@ fi # Set pipefail to make sure that the script fails if any of the commands fail set -euo pipefail -# build the framework project `CodeLanguages-Container` -status "Clean Building CodeLanguages-Container.xcodeproj..." +# set path variables +PRODUCTS_PATH="$PWD/DerivedData/Build/Products/Release" +OUTPUT_PATH="CodeLanguagesContainer.xcframework" + +# remove previous generated files +rm -rf "$OUTPUT_PATH" 2>/dev/null || true +rm -f "$OUTPUT_PATH".zip 2>/dev/null || true +status "Removed previous generated files!" + +# Function to patch tree-sitter-properties Package.swift to include scanner.c +patch_tree_sitter_properties() { + local derived_path="$1" + local props_pkg="$derived_path/SourcePackages/checkouts/tree-sitter-properties/Package.swift" + if [ -f "$props_pkg" ]; then + # Replace the dynamic file check with a static sources list + sed -i '' 's/var sources = \["src\/parser.c"\]/var sources = ["src\/parser.c", "src\/scanner.c"]/' "$props_pkg" + sed -i '' '/if FileManager.default.fileExists/,/}/d' "$props_pkg" + status "Patched tree-sitter-properties in $derived_path" + fi +} + +# Build for macOS +status "Building for macOS..." +# First resolve packages +xcodebuild \ + -project CodeLanguages-Container/CodeLanguages-Container.xcodeproj \ + -scheme CodeLanguages-Container \ + -destination "platform=macOS" \ + -derivedDataPath DerivedData \ + $QUIET_FLAG -resolvePackageDependencies &> $QUIET_OUTPUT +# Patch tree-sitter-properties +patch_tree_sitter_properties "$PWD/DerivedData" +# Then build xcodebuild \ -project CodeLanguages-Container/CodeLanguages-Container.xcodeproj \ -scheme CodeLanguages-Container \ @@ -39,26 +71,77 @@ xcodebuild \ -configuration Release \ ARCHS="arm64 x86_64" \ ONLY_ACTIVE_ARCH=NO \ - $QUIET_FLAG clean build &> $QUIET_OUTPUT -status "Build complete!" + BUILD_LIBRARY_FOR_DISTRIBUTION=YES \ + $QUIET_FLAG build &> $QUIET_OUTPUT +status "macOS build complete!" -# set path variables -PRODUCTS_PATH="$PWD/DerivedData/Build/Products/Release" -FRAMEWORK_PATH="$PRODUCTS_PATH/CodeLanguages_Container.framework" -OUTPUT_PATH="CodeLanguagesContainer.xcframework" +# Build for iOS device +status "Building for iOS device..." +# First resolve packages +xcodebuild \ + -project CodeLanguages-Container/CodeLanguages-Container.xcodeproj \ + -scheme CodeLanguages-Container \ + -destination "generic/platform=iOS" \ + -derivedDataPath DerivedData-iOS \ + $QUIET_FLAG -resolvePackageDependencies &> $QUIET_OUTPUT +# Patch tree-sitter-properties +patch_tree_sitter_properties "$PWD/DerivedData-iOS" +# Then build +xcodebuild \ + -project CodeLanguages-Container/CodeLanguages-Container.xcodeproj \ + -scheme CodeLanguages-Container \ + -destination "generic/platform=iOS" \ + -derivedDataPath DerivedData-iOS \ + -configuration Release \ + ARCHS="arm64" \ + ONLY_ACTIVE_ARCH=NO \ + BUILD_LIBRARY_FOR_DISTRIBUTION=YES \ + SUPPORTS_MACCATALYST=NO \ + $QUIET_FLAG build &> $QUIET_OUTPUT +status "iOS device build complete!" + +# Build for iOS Simulator +status "Building for iOS Simulator..." +# First resolve packages +xcodebuild \ + -project CodeLanguages-Container/CodeLanguages-Container.xcodeproj \ + -scheme CodeLanguages-Container \ + -destination "generic/platform=iOS Simulator" \ + -derivedDataPath DerivedData-Sim \ + $QUIET_FLAG -resolvePackageDependencies &> $QUIET_OUTPUT +# Patch tree-sitter-properties +patch_tree_sitter_properties "$PWD/DerivedData-Sim" +# Then build +xcodebuild \ + -project CodeLanguages-Container/CodeLanguages-Container.xcodeproj \ + -scheme CodeLanguages-Container \ + -destination "generic/platform=iOS Simulator" \ + -derivedDataPath DerivedData-Sim \ + -configuration Release \ + ARCHS="arm64 x86_64" \ + ONLY_ACTIVE_ARCH=NO \ + BUILD_LIBRARY_FOR_DISTRIBUTION=YES \ + $QUIET_FLAG build &> $QUIET_OUTPUT +status "iOS Simulator build complete!" -# remove previous generated files -rm -rf "$OUTPUT_PATH" -rm "$OUTPUT_PATH".zip -status "Removed previous generated files!" +# Set framework paths +MACOS_FRAMEWORK_PATH="$PWD/DerivedData/Build/Products/Release/CodeLanguages_Container.framework" +IOS_FRAMEWORK_PATH="$PWD/DerivedData-iOS/Build/Products/Release-iphoneos/CodeLanguages_Container.framework" +IOS_SIM_FRAMEWORK_PATH="$PWD/DerivedData-Sim/Build/Products/Release-iphonesimulator/CodeLanguages_Container.framework" -# build the binary framework +# Create xcframework with all platforms status "Creating CodeLanguagesContainer.xcframework..." xcodebuild \ -create-xcframework \ - -framework "$FRAMEWORK_PATH" \ + -framework "$MACOS_FRAMEWORK_PATH" \ + -framework "$IOS_FRAMEWORK_PATH" \ + -framework "$IOS_SIM_FRAMEWORK_PATH" \ -output "$OUTPUT_PATH" &> $QUIET_OUTPUT +# Clean up iOS DerivedData +rm -rf "$PWD/DerivedData-iOS" +rm -rf "$PWD/DerivedData-Sim" + # zip the xcframework status "Zipping CodeLanguagesContainer.xcframework..." zip -r -q -y "$OUTPUT_PATH".zip "$OUTPUT_PATH" @@ -71,7 +154,7 @@ status "CodeLanguagesContainer.xcframework.zip created!" # copy language queries to package resources # set path variables CHECKOUTS_PATH="$PWD/DerivedData/SourcePackages/checkouts" -RESOURCES_PATH="$PWD/Sources/CodeEditLanguages/Resources" +RESOURCES_PATH="$PWD/Sources/CodeEditLanguages/Queries" # remove previous copied files status "Copying language queries to package resources..." @@ -85,16 +168,16 @@ OLD_PWD="$PWD" for lang in $LIST ; do # determine how many targets a given package has cd $lang - + # get package info as JSON manifest=$(swift package dump-package) # use jq to get the target path targets=$(echo $manifest | jq -r '.targets[] | select(.type != "test") | .path') - + # use jq to count number of targets count=$(echo $manifest | jq '[.targets[] | select(.type != "test")] | length') - + # Determine if target paths are all '.' same=1 for target in $targets; do @@ -107,7 +190,7 @@ for lang in $LIST ; do # loop through targets for target in $targets; do name=${lang##*/} - + # if there is only one target, use name # otherwise use target if [[ $count -eq 1 || ($count -ne 1 && $same -eq 1) ]]; then @@ -115,11 +198,11 @@ for lang in $LIST ; do else mkdir -p $RESOURCES_PATH/$target fi - + highlights=$( find $lang/$target -type f -name "*.scm" ) for highlight in $highlights ; do highlight_name=${highlight##*/} - + # if there is only one target, use name # otherwise use target if [[ $count -eq 1 || ($count -ne 1 && $same -eq 1) ]]; then @@ -128,7 +211,7 @@ for lang in $LIST ; do cp -f $highlight $RESOURCES_PATH/$target/$highlight_name fi done - + # If target paths are all '.', break out of loop if [[ $same -eq 1 || ($count -ne 1 && $same -eq 1) ]]; then break