From 65239ea0f0b68cb35fc38cbe947fff26167e7f5d Mon Sep 17 00:00:00 2001 From: jess Date: Mon, 6 Apr 2026 21:46:03 -0700 Subject: [PATCH] fix duplicate tree-sitter symbols and ar -D flag on macOS --- build.sh | 1 + core/Cargo.toml | 6 ++---- core/src/highlight.rs | 30 ++++++------------------------ debug.sh | 1 + 4 files changed, 10 insertions(+), 28 deletions(-) diff --git a/build.sh b/build.sh index d561b82..d713b46 100755 --- a/build.sh +++ b/build.sh @@ -12,6 +12,7 @@ SDK=$(xcrun --show-sdk-path) RUST_LIB="$ROOT/core/target/release" export MACOSX_DEPLOYMENT_TARGET=14.0 +export ZERO_AR_DATE=0 echo "Building Rust core (release)..." cd "$ROOT/core" && cargo build --release if [ $? -ne 0 ]; then diff --git a/core/Cargo.toml b/core/Cargo.toml index e7197f2..82d93df 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -31,15 +31,13 @@ tree-sitter-css = "0.23" tree-sitter-json = "0.24" tree-sitter-lua = "0.4" tree-sitter-php = "0.23" -tree-sitter-toml = "0.20" +tree-sitter-toml-ng = "0.7" tree-sitter-yaml = "0.6" tree-sitter-swift = "0.6" tree-sitter-zig = "1" -tree-sitter-sql = "0.0.2" +tree-sitter-sequel = "0.3" tree-sitter-md = "0.5" tree-sitter-make = "1" -tree-sitter-dockerfile = "0.2" -tree-sitter-kotlin = "0.3" [build-dependencies] cbindgen = "0.27" diff --git a/core/src/highlight.rs b/core/src/highlight.rs index 4b109cb..6aa1574 100644 --- a/core/src/highlight.rs +++ b/core/src/highlight.rs @@ -1,11 +1,5 @@ -use tree_sitter_highlight::{HighlightConfiguration, HighlightEvent, Highlighter}; use tree_sitter::Language; - -/// Convert an old-API tree-sitter Language (v0.19/v0.20) to current v0.24. -/// Both are newtype wrappers around `*const TSLanguage`; the C ABI is identical. -unsafe fn lang_compat(old: T) -> Language { - std::mem::transmute_copy(&old) -} +use tree_sitter_highlight::{HighlightConfiguration, HighlightEvent, Highlighter}; const HIGHLIGHT_NAMES: &[&str] = &[ "keyword", @@ -147,13 +141,13 @@ fn lang_def(lang_id: &str) -> Option { locals: "", }, "toml" => LangDef { - language: unsafe { lang_compat(tree_sitter_toml::language()) }, - highlights: tree_sitter_toml::HIGHLIGHT_QUERY, + language: tree_sitter_toml_ng::LANGUAGE.into(), + highlights: tree_sitter_toml_ng::HIGHLIGHTS_QUERY, injections: "", locals: "", }, "yaml" => LangDef { - language: unsafe { lang_compat(tree_sitter_yaml::language()) }, + language: tree_sitter_yaml::language(), highlights: tree_sitter_yaml::HIGHLIGHTS_QUERY, injections: "", locals: "", @@ -171,8 +165,8 @@ fn lang_def(lang_id: &str) -> Option { locals: "", }, "sql" => LangDef { - language: unsafe { lang_compat(tree_sitter_sql::language()) }, - highlights: include_str!("../queries/sql-highlights.scm"), + language: tree_sitter_sequel::LANGUAGE.into(), + highlights: tree_sitter_sequel::HIGHLIGHTS_QUERY, injections: "", locals: "", }, @@ -182,18 +176,6 @@ fn lang_def(lang_id: &str) -> Option { injections: "", locals: "", }, - "dockerfile" => LangDef { - language: unsafe { lang_compat(tree_sitter_dockerfile::language()) }, - highlights: include_str!("../queries/dockerfile-highlights.scm"), - injections: "", - locals: "", - }, - "kotlin" => LangDef { - language: unsafe { lang_compat(tree_sitter_kotlin::language()) }, - highlights: include_str!("../queries/kotlin-highlights.scm"), - injections: "", - locals: "", - }, _ => return None, }; Some(ld) diff --git a/debug.sh b/debug.sh index 348d3e5..137c202 100755 --- a/debug.sh +++ b/debug.sh @@ -12,6 +12,7 @@ LOGFILE="$HOME/swiftly/debug.log" SDK=$(xcrun --show-sdk-path) RUST_LIB="$ROOT/core/target/debug" +export ZERO_AR_DATE=0 echo "Building Rust core (debug)..." cd "$ROOT/core" && cargo build cd "$ROOT"