on master help sign in
Remove embed_runtime feature
0fdb626Blaž Hrastnik
Cargo.lock−34
@@ -317,7 +317,6 @@ dependencies = [
317 "quickcheck",
317 "quickcheck",
318 "regex",
318 "regex",
319 "ropey",
319 "ropey",
320− "rust-embed",
321 "serde",
320 "serde",
322 "similar",
321 "similar",
323 "smallvec",
322 "smallvec",
@@ -773,39 +772,6 @@ dependencies = [
773 "smallvec",
772 "smallvec",
774]
773]
775
774
776−[[package]]
777−name = "rust-embed"
778−version = "5.9.0"
779−source = "registry+https://github.com/rust-lang/crates.io-index"
780−checksum = "2fe1fe6aac5d6bb9e1ffd81002340363272a7648234ec7bdfac5ee202cb65523"
781−dependencies = [
782− "rust-embed-impl",
783− "rust-embed-utils",
784− "walkdir",
785−]
786−
787−[[package]]
788−name = "rust-embed-impl"
789−version = "5.9.0"
790−source = "registry+https://github.com/rust-lang/crates.io-index"
791−checksum = "3ed91c41c42ef7bf687384439c312e75e0da9c149b0390889b94de3c7d9d9e66"
792−dependencies = [
793− "proc-macro2",
794− "quote",
795− "rust-embed-utils",
796− "syn",
797− "walkdir",
798−]
799−
800−[[package]]
801−name = "rust-embed-utils"
802−version = "5.1.0"
803−source = "registry+https://github.com/rust-lang/crates.io-index"
804−checksum = "2a512219132473ab0a77b52077059f1c47ce4af7fbdc94503e9862a34422876d"
805−dependencies = [
806− "walkdir",
807−]
808−
809[[package]]
775[[package]]
810name = "ryu"
776name = "ryu"
811version = "1.0.5"
777version = "1.0.5"
README.md−7
@@ -51,13 +51,6 @@ that sets the variable to the install dir.
51> NOTE: running via cargo also doesn't require setting explicit `HELIX_RUNTIME` path, it will automatically
51> NOTE: running via cargo also doesn't require setting explicit `HELIX_RUNTIME` path, it will automatically
52> detect the `runtime` directory in the project root.
52> detect the `runtime` directory in the project root.
53
53
54−Alternatively, if you want to embed the `runtime/` directory into the Helix binary you can build
55−it with:
56−
57−```
58−cargo install --path helix-term --features "embed_runtime"
59−```
60−
61[![Packaging status](https://repology.org/badge/vertical-allrepos/helix.svg)](https://repology.org/project/helix/versions)
54[![Packaging status](https://repology.org/badge/vertical-allrepos/helix.svg)](https://repology.org/project/helix/versions)
62
55
63## MacOS
56## MacOS
book/src/install.md+3−10
@@ -37,13 +37,6 @@ cargo install --path helix-term
37
37
38This will install the `hx` binary to `$HOME/.cargo/bin`.
38This will install the `hx` binary to `$HOME/.cargo/bin`.
39
39
40−Now copy the `runtime/` directory somewhere. Helix will by default look for the
40+Helix also needs it's runtime files so make sure to copy/symlink the `runtime/` directory into the
41−runtime inside the same folder as the executable, but that can be overriden via
41+config directory (for example `~/.config/helix/runtime` on Linux/macOS). This location can be overriden
42−the `HELIX_RUNTIME` environment variable.
42+via the `HELIX_RUNTIME` environment variable.
43−
44−If you want to embed the `runtime/` directory into the Helix binary you can build
45−it with:
46−
47−```
48−cargo install --path helix-term --features "embed_runtime"
49−```
helix-core/Cargo.toml−2
@@ -11,7 +11,6 @@ homepage = "https://helix-editor.com"
11include = ["src/**/*", "README.md"]
11include = ["src/**/*", "README.md"]
12
12
13[features]
13[features]
14−embed_runtime = ["rust-embed"]
15
14
16[dependencies]
15[dependencies]
17helix-syntax = { version = "0.3", path = "../helix-syntax" }
16helix-syntax = { version = "0.3", path = "../helix-syntax" }
@@ -34,7 +33,6 @@ toml = "0.5"
34similar = "1.3"
33similar = "1.3"
35
34
36etcetera = "0.3"
35etcetera = "0.3"
37−rust-embed = { version = "5.9.0", optional = true }
38
36
39[dev-dependencies]
37[dev-dependencies]
40quickcheck = { version = "1", default-features = false }
38quickcheck = { version = "1", default-features = false }
helix-core/src/lib.rs−1
@@ -58,7 +58,6 @@ pub fn find_root(root: Option<&str>) -> Option<std::path::PathBuf> {
58 None
58 None
59}
59}
60
60
61−#[cfg(not(embed_runtime))]
62pub fn runtime_dir() -> std::path::PathBuf {
61pub fn runtime_dir() -> std::path::PathBuf {
63 if let Ok(dir) = std::env::var("HELIX_RUNTIME") {
62 if let Ok(dir) = std::env::var("HELIX_RUNTIME") {
64 return dir.into();
63 return dir.into();
helix-core/src/syntax.rs−29
@@ -84,7 +84,6 @@ pub struct IndentQuery {
84 pub outdent: HashSet<String>,
84 pub outdent: HashSet<String>,
85}
85}
86
86
87−#[cfg(not(feature = "embed_runtime"))]
88fn load_runtime_file(language: &str, filename: &str) -> Result<String, std::io::Error> {
87fn load_runtime_file(language: &str, filename: &str) -> Result<String, std::io::Error> {
89 let path = crate::RUNTIME_DIR
88 let path = crate::RUNTIME_DIR
90 .join("queries")
89 .join("queries")
@@ -93,34 +92,6 @@ fn load_runtime_file(language: &str, filename: &str) -> Result<String, std::io::
93 std::fs::read_to_string(&path)
92 std::fs::read_to_string(&path)
94}
93}
95
94
96−#[cfg(feature = "embed_runtime")]
97−fn load_runtime_file(language: &str, filename: &str) -> Result<String, Box<dyn std::error::Error>> {
98− use std::path::PathBuf;
99−
100− #[derive(rust_embed::RustEmbed)]
101− #[folder = "../runtime/"]
102− struct Runtime;
103−
104− #[derive(Debug)]
105− struct EmbeddedFileNotFoundError {
106− path: PathBuf,
107− }
108− impl std::error::Error for EmbeddedFileNotFoundError {}
109− impl fmt::Display for EmbeddedFileNotFoundError {
110− fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
111− write!(f, "failed to load embedded file {}", self.path.display())
112− }
113− }
114−
115− let path = PathBuf::from("queries").join(language).join(filename);
116−
117− if let Some(query_bytes) = Runtime::get(&path.display().to_string()) {
118− String::from_utf8(query_bytes.to_vec()).map_err(|err| err.into())
119− } else {
120− Err(Box::new(EmbeddedFileNotFoundError { path }))
121− }
122−}
123−
124fn read_query(language: &str, filename: &str) -> String {
95fn read_query(language: &str, filename: &str) -> String {
125 static INHERITS_REGEX: Lazy<Regex> =
96 static INHERITS_REGEX: Lazy<Regex> =
126 Lazy::new(|| Regex::new(r";+\s*inherits\s*:?\s*([a-z_,()]+)\s*").unwrap());
97 Lazy::new(|| Regex::new(r";+\s*inherits\s*:?\s*([a-z_,()]+)\s*").unwrap());
helix-term/Cargo.toml−1
@@ -15,7 +15,6 @@ build = true
15app = true
15app = true
16
16
17[features]
17[features]
18−embed_runtime = ["helix-core/embed_runtime"]
19
18
20[[bin]]
19[[bin]]
21name = "hx"
20name = "hx"