diff --git a/Cargo.lock b/Cargo.lock index 41a5cc0c9..6d13648a9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3683,6 +3683,7 @@ dependencies = [ "dirs 5.0.1", "env_logger 0.10.2", "libc", + "limbo_completion", "miette", "nu-ansi-term 0.50.1", "rustyline", @@ -3719,7 +3720,6 @@ dependencies = [ "libc", "libloading", "libm", - "limbo_completion", "limbo_crypto", "limbo_csv", "limbo_ipaddr", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index b4e233034..5519f7ae8 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -28,9 +28,8 @@ ctrlc = "3.4.4" dirs = "5.0.1" env_logger = "0.10.1" libc = "0.2.172" -turso_core = { path = "../core", default-features = true, features = [ - "completion", -] } +turso_core = { path = "../core", default-features = true, features = [] } +limbo_completion = { path = "../extensions/completion", features = ["static"] } miette = { version = "7.4.0", features = ["fancy"] } nu-ansi-term = {version = "0.50.1", features = ["serde", "derive_serde_style"]} rustyline = { version = "15.0.0", default-features = true, features = [ diff --git a/cli/app.rs b/cli/app.rs index 361271bef..fe556028a 100644 --- a/cli/app.rs +++ b/cli/app.rs @@ -10,12 +10,9 @@ use crate::{ opcodes_dictionary::OPCODE_DESCRIPTIONS, HISTORY_FILE, }; -use comfy_table::{Attribute, Cell, CellAlignment, ContentArrangement, Row, Table}; -use tracing_appender::non_blocking::WorkerGuard; -use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilter}; -use turso_core::{Database, LimboError, Statement, StepResult, Value}; - +use anyhow::anyhow; use clap::Parser; +use comfy_table::{Attribute, Cell, CellAlignment, ContentArrangement, Row, Table}; use rustyline::{error::ReadlineError, history::DefaultHistory, Editor}; use std::{ fmt, @@ -27,6 +24,9 @@ use std::{ }, time::{Duration, Instant}, }; +use tracing_appender::non_blocking::WorkerGuard; +use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilter}; +use turso_core::{Database, LimboError, Statement, StepResult, Value}; #[derive(Parser)] #[command(name = "limbo")] @@ -140,6 +140,12 @@ impl Limbo { ) }; let conn = db.connect()?; + let mut ext_api = conn.build_turso_ext(); + if unsafe { !limbo_completion::register_extension_static(&mut ext_api).is_ok() } { + return Err(anyhow!( + "Failed to register completion extension".to_string() + )); + } let interrupt_count = Arc::new(AtomicUsize::new(0)); { let interrupt_count: Arc = Arc::clone(&interrupt_count); diff --git a/core/Cargo.toml b/core/Cargo.toml index b0164d1c8..484d8b45d 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -26,7 +26,6 @@ time = ["limbo_time/static"] crypto = ["limbo_crypto/static"] series = ["limbo_series/static"] ipaddr = ["limbo_ipaddr/static"] -completion = ["limbo_completion/static"] static = ["turso_ext/static"] fuzz = [] csv = ["limbo_csv/static"] @@ -71,7 +70,6 @@ limbo_time = { workspace = true, optional = true, features = ["static"] } limbo_crypto = { workspace = true, optional = true, features = ["static"] } limbo_series = { workspace = true, optional = true, features = ["static"] } limbo_ipaddr = { workspace = true, optional = true, features = ["static"] } -limbo_completion = { workspace = true, optional = true, features = ["static"] } limbo_csv = { workspace = true, optional = true, features = ["static"] } miette = "7.6.0" strum = { workspace = true } diff --git a/core/ext/mod.rs b/core/ext/mod.rs index cad0b12ce..692d822d3 100644 --- a/core/ext/mod.rs +++ b/core/ext/mod.rs @@ -200,10 +200,6 @@ impl Connection { if unsafe { !limbo_ipaddr::register_extension_static(&mut ext_api).is_ok() } { return Err("Failed to register ipaddr extension".to_string()); } - #[cfg(feature = "completion")] - if unsafe { !limbo_completion::register_extension_static(&mut ext_api).is_ok() } { - return Err("Failed to register completion extension".to_string()); - } #[cfg(feature = "csv")] if unsafe { !limbo_csv::register_extension_static(&mut ext_api).is_ok() } { return Err("Failed to register csv extension".to_string()); diff --git a/scripts/publish-crates.sh b/scripts/publish-crates.sh index 281fb5a78..ce539dfc4 100755 --- a/scripts/publish-crates.sh +++ b/scripts/publish-crates.sh @@ -2,7 +2,6 @@ cargo publish -p turso_macros cargo publish -p turso_ext -cargo publish -p limbo_completion cargo publish -p limbo_crypto cargo publish -p limbo_csv cargo publish -p limbo_percentile