No more passing around the helix context for every function call

pull/8675/merge^2
mattwparas 11 months ago
parent 726f4f45f6
commit 01996b2bec

133
Cargo.lock generated

@ -65,17 +65,6 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "ahash"
version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
dependencies = [
"getrandom",
"once_cell",
"version_check",
]
[[package]] [[package]]
name = "ahash" name = "ahash"
version = "0.8.3" version = "0.8.3"
@ -159,9 +148,9 @@ dependencies = [
[[package]] [[package]]
name = "async-ffi" name = "async-ffi"
version = "0.4.1" version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ed5a937a789391ebc1c77d3a15b060e0d100e6d7c483a2af3f250d6b8dc2a23" checksum = "f4de21c0feef7e5a556e51af767c953f0501f7f300ba785cc99c47bdc8081a50"
dependencies = [ dependencies = [
"abi_stable", "abi_stable",
] ]
@ -187,12 +176,6 @@ dependencies = [
"rustc-demangle", "rustc-demangle",
] ]
[[package]]
name = "beef"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1"
[[package]] [[package]]
name = "bincode" name = "bincode"
version = "1.3.3" version = "1.3.3"
@ -347,17 +330,6 @@ dependencies = [
"unicode-width", "unicode-width",
] ]
[[package]]
name = "colored"
version = "2.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6"
dependencies = [
"is-terminal",
"lazy_static",
"windows-sys",
]
[[package]] [[package]]
name = "const_panic" name = "const_panic"
version = "0.2.8" version = "0.2.8"
@ -481,12 +453,15 @@ dependencies = [
[[package]] [[package]]
name = "dashmap" name = "dashmap"
version = "4.0.2" version = "5.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c" checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"num_cpus", "hashbrown 0.14.0",
"lock_api",
"once_cell",
"parking_lot_core",
] ]
[[package]] [[package]]
@ -1394,16 +1369,6 @@ dependencies = [
"memmap2 0.5.10", "memmap2 0.5.10",
] ]
[[package]]
name = "hashbrown"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
dependencies = [
"ahash 0.7.6",
"serde",
]
[[package]] [[package]]
name = "hashbrown" name = "hashbrown"
version = "0.12.3" version = "0.12.3"
@ -1416,7 +1381,8 @@ version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e"
dependencies = [ dependencies = [
"ahash 0.8.3", "ahash",
"serde",
] ]
[[package]] [[package]]
@ -1425,7 +1391,7 @@ version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a"
dependencies = [ dependencies = [
"ahash 0.8.3", "ahash",
"allocator-api2", "allocator-api2",
] ]
@ -1433,7 +1399,7 @@ dependencies = [
name = "helix-core" name = "helix-core"
version = "0.6.0" version = "0.6.0"
dependencies = [ dependencies = [
"ahash 0.8.3", "ahash",
"arc-swap", "arc-swap",
"bitflags 2.4.0", "bitflags 2.4.0",
"chrono", "chrono",
@ -1484,7 +1450,7 @@ dependencies = [
name = "helix-event" name = "helix-event"
version = "0.6.0" version = "0.6.0"
dependencies = [ dependencies = [
"ahash 0.8.3", "ahash",
"anyhow", "anyhow",
"futures-executor", "futures-executor",
"hashbrown 0.13.2", "hashbrown 0.13.2",
@ -1720,9 +1686,9 @@ dependencies = [
[[package]] [[package]]
name = "im-lists" name = "im-lists"
version = "0.5.0" version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbe1ea6399f751563e6f5d88bff90a5c7418f8e7abbdd34708412be793a73949" checksum = "a8ce6c776654abe411e4ccd52524f87e8ca16e2c487dbe127521eb048a46f7e6"
[[package]] [[package]]
name = "im-rc" name = "im-rc"
@ -1744,7 +1710,7 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e98c1d0ad70fc91b8b9654b1f33db55e59579d3b3de2bffdced0fdb810570cb8" checksum = "e98c1d0ad70fc91b8b9654b1f33db55e59579d3b3de2bffdced0fdb810570cb8"
dependencies = [ dependencies = [
"ahash 0.8.3", "ahash",
"hashbrown 0.12.3", "hashbrown 0.12.3",
] ]
@ -1784,17 +1750,6 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "is-terminal"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b"
dependencies = [
"hermit-abi",
"rustix",
"windows-sys",
]
[[package]] [[package]]
name = "itoa" name = "itoa"
version = "1.0.9" version = "1.0.9"
@ -1821,12 +1776,12 @@ dependencies = [
[[package]] [[package]]
name = "lasso" name = "lasso"
version = "0.6.0" version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aeb7b21a526375c5ca55f1a6dfd4e1fad9fa4edd750f530252a718a44b2608f0" checksum = "4644821e1c3d7a560fe13d842d13f587c07348a1a05d3a797152d41c90c56df2"
dependencies = [ dependencies = [
"dashmap", "dashmap",
"hashbrown 0.11.2", "hashbrown 0.13.2",
"serde", "serde",
] ]
@ -1884,29 +1839,6 @@ version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
[[package]]
name = "logos"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf8b031682c67a8e3d5446840f9573eb7fe26efe7ec8d195c9ac4c0647c502f1"
dependencies = [
"logos-derive",
]
[[package]]
name = "logos-derive"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1d849148dbaf9661a6151d1ca82b13bb4c4c128146a88d05253b38d4e2f496c"
dependencies = [
"beef",
"fnv",
"proc-macro2",
"quote",
"regex-syntax 0.6.29",
"syn 1.0.109",
]
[[package]] [[package]]
name = "lsp-types" name = "lsp-types"
version = "0.94.1" version = "0.94.1"
@ -2426,18 +2358,18 @@ checksum = "ad977052201c6de01a8ef2aa3378c4bd23217a056337d1d6da40468d267a4fb0"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.188" version = "1.0.193"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.188" version = "1.0.193"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -2446,9 +2378,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.107" version = "1.0.108"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b"
dependencies = [ dependencies = [
"itoa", "itoa",
"ryu", "ryu",
@ -2593,7 +2525,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]] [[package]]
name = "steel-core" name = "steel-core"
version = "0.5.0" version = "0.5.0"
source = "git+https://github.com/mattwparas/steel.git#45f582560445da5faaaa19098c5b50e7f872c10e" source = "git+https://github.com/mattwparas/steel.git#03fe335199334f44396949fda2508de3545bc895"
dependencies = [ dependencies = [
"abi_stable", "abi_stable",
"anyhow", "anyhow",
@ -2601,7 +2533,6 @@ dependencies = [
"bincode", "bincode",
"chrono", "chrono",
"codespan-reporting", "codespan-reporting",
"colored",
"futures-task", "futures-task",
"futures-util", "futures-util",
"fxhash", "fxhash",
@ -2609,7 +2540,6 @@ dependencies = [
"im-rc", "im-rc",
"lasso", "lasso",
"log", "log",
"logos",
"num", "num",
"once_cell", "once_cell",
"pretty", "pretty",
@ -2619,7 +2549,6 @@ dependencies = [
"serde", "serde",
"serde_derive", "serde_derive",
"serde_json", "serde_json",
"slotmap",
"steel-derive", "steel-derive",
"steel-gen", "steel-gen",
"steel-parser", "steel-parser",
@ -2630,7 +2559,7 @@ dependencies = [
[[package]] [[package]]
name = "steel-derive" name = "steel-derive"
version = "0.4.0" version = "0.4.0"
source = "git+https://github.com/mattwparas/steel.git#45f582560445da5faaaa19098c5b50e7f872c10e" source = "git+https://github.com/mattwparas/steel.git#03fe335199334f44396949fda2508de3545bc895"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -2640,7 +2569,7 @@ dependencies = [
[[package]] [[package]]
name = "steel-gen" name = "steel-gen"
version = "0.2.0" version = "0.2.0"
source = "git+https://github.com/mattwparas/steel.git#45f582560445da5faaaa19098c5b50e7f872c10e" source = "git+https://github.com/mattwparas/steel.git#03fe335199334f44396949fda2508de3545bc895"
dependencies = [ dependencies = [
"codegen", "codegen",
"serde", "serde",
@ -2650,10 +2579,12 @@ dependencies = [
[[package]] [[package]]
name = "steel-parser" name = "steel-parser"
version = "0.4.0" version = "0.4.0"
source = "git+https://github.com/mattwparas/steel.git#45f582560445da5faaaa19098c5b50e7f872c10e" source = "git+https://github.com/mattwparas/steel.git#03fe335199334f44396949fda2508de3545bc895"
dependencies = [ dependencies = [
"logos", "lasso",
"num-bigint", "num-bigint",
"once_cell",
"pretty",
"serde", "serde",
"serde_derive", "serde_derive",
] ]

@ -19,8 +19,8 @@ default-members = [
[workspace.dependencies] [workspace.dependencies]
# If working locally, use the local path dependency # If working locally, use the local path dependency
# steel-core = { path = "../../steel/crates/steel-core", version = "0.5.0", features = ["modules", "anyhow", "dylibs", "colors"] } # steel-core = { path = "../../steel/crates/steel-core", version = "0.5.0", features = ["modules", "anyhow", "dylibs"] }
steel-core = { git = "https://github.com/mattwparas/steel.git", version = "0.5.0", features = ["modules", "anyhow", "dylibs", "colors"] } steel-core = { git = "https://github.com/mattwparas/steel.git", version = "0.5.0", features = ["modules", "anyhow", "dylibs"] }
tree-sitter = { version = "0.20", git = "https://github.com/tree-sitter/tree-sitter", rev = "ab09ae20d640711174b8da8a654f6b3dec93da1a" } tree-sitter = { version = "0.20", git = "https://github.com/tree-sitter/tree-sitter", rev = "ab09ae20d640711174b8da8a654f6b3dec93da1a" }
nucleo = "0.2.0" nucleo = "0.2.0"

@ -1,16 +1,12 @@
#[cfg(feature = "steel")] #[cfg(feature = "steel")]
pub mod steel_implementations { pub mod steel_implementations {
use std::{borrow::Cow, cell::Cell, rc::Rc}; use std::borrow::Cow;
use ropey::iter::Chars;
use smallvec::SmallVec; use smallvec::SmallVec;
use steel::{ use steel::{
gc::unsafe_erased_pointers::CustomReference,
rvals::{Custom, SteelString}, rvals::{Custom, SteelString},
steel_vm::{ steel_vm::{builtin::BuiltInModule, register_fn::RegisterFn},
builtin::BuiltInModule, register_fn::RegisterFn, register_fn::RegisterFnBorrowed,
},
}; };
impl steel::rvals::Custom for crate::Position {} impl steel::rvals::Custom for crate::Position {}
@ -100,10 +96,6 @@ pub mod steel_implementations {
maybe_owned.trim_start().starts_with(pat.as_str()) maybe_owned.trim_start().starts_with(pat.as_str())
} }
// pub fn as_cow(&'a self) -> SRopeSliceCowStr<'a> {
// SRopeSliceCowStr(std::borrow::Cow::from(self.slice))
// }
} }
pub fn rope_module() -> BuiltInModule { pub fn rope_module() -> BuiltInModule {

@ -1,6 +1,5 @@
use std::{borrow::Cow, collections::HashMap}; use std::{borrow::Cow, collections::HashMap};
use once_cell::sync::Lazy;
use tree_sitter::{Query, QueryCursor, QueryPredicateArg}; use tree_sitter::{Query, QueryCursor, QueryPredicateArg};
use crate::{ use crate::{

@ -190,8 +190,6 @@ macro_rules! static_commands {
impl MappableCommand { impl MappableCommand {
pub fn execute(&self, cx: &mut Context) { pub fn execute(&self, cx: &mut Context) {
log::info!("Running command");
match &self { match &self {
Self::Typable { name, args, doc: _ } => { Self::Typable { name, args, doc: _ } => {
let args: Vec<Cow<str>> = args.iter().map(Cow::from).collect(); let args: Vec<Cow<str>> = args.iter().map(Cow::from).collect();

File diff suppressed because it is too large Load Diff

@ -883,7 +883,6 @@ pub struct Breakpoint {
use futures_util::stream::{Flatten, Once}; use futures_util::stream::{Flatten, Once};
#[repr(C)]
pub struct Editor { pub struct Editor {
/// Current editing mode. /// Current editing mode.
pub mode: Mode, pub mode: Mode,

@ -1,3 +1,3 @@
[toolchain] [toolchain]
channel = "1.65.0" channel = "1.70.0"
components = ["rustfmt", "rust-src"] components = ["rustfmt", "rust-src"]
Loading…
Cancel
Save