mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 01:16:18 +04:00
Remove embed_runtime feature
It's no longer practical to maintain. Closes #451
This commit is contained in:
parent
f88d4c1e20
commit
0fdb626c2c
34
Cargo.lock
generated
34
Cargo.lock
generated
@ -317,7 +317,6 @@ dependencies = [
|
||||
"quickcheck",
|
||||
"regex",
|
||||
"ropey",
|
||||
"rust-embed",
|
||||
"serde",
|
||||
"similar",
|
||||
"smallvec",
|
||||
@ -773,39 +772,6 @@ dependencies = [
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rust-embed"
|
||||
version = "5.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2fe1fe6aac5d6bb9e1ffd81002340363272a7648234ec7bdfac5ee202cb65523"
|
||||
dependencies = [
|
||||
"rust-embed-impl",
|
||||
"rust-embed-utils",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rust-embed-impl"
|
||||
version = "5.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3ed91c41c42ef7bf687384439c312e75e0da9c149b0390889b94de3c7d9d9e66"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rust-embed-utils",
|
||||
"syn",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rust-embed-utils"
|
||||
version = "5.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2a512219132473ab0a77b52077059f1c47ce4af7fbdc94503e9862a34422876d"
|
||||
dependencies = [
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.5"
|
||||
|
@ -51,13 +51,6 @@ # Installation
|
||||
> NOTE: running via cargo also doesn't require setting explicit `HELIX_RUNTIME` path, it will automatically
|
||||
> detect the `runtime` directory in the project root.
|
||||
|
||||
Alternatively, if you want to embed the `runtime/` directory into the Helix binary you can build
|
||||
it with:
|
||||
|
||||
```
|
||||
cargo install --path helix-term --features "embed_runtime"
|
||||
```
|
||||
|
||||
[![Packaging status](https://repology.org/badge/vertical-allrepos/helix.svg)](https://repology.org/project/helix/versions)
|
||||
|
||||
## MacOS
|
||||
|
@ -37,13 +37,6 @@ ## Build from source
|
||||
|
||||
This will install the `hx` binary to `$HOME/.cargo/bin`.
|
||||
|
||||
Now copy the `runtime/` directory somewhere. Helix will by default look for the
|
||||
runtime inside the same folder as the executable, but that can be overriden via
|
||||
the `HELIX_RUNTIME` environment variable.
|
||||
|
||||
If you want to embed the `runtime/` directory into the Helix binary you can build
|
||||
it with:
|
||||
|
||||
```
|
||||
cargo install --path helix-term --features "embed_runtime"
|
||||
```
|
||||
Helix also needs it's runtime files so make sure to copy/symlink the `runtime/` directory into the
|
||||
config directory (for example `~/.config/helix/runtime` on Linux/macOS). This location can be overriden
|
||||
via the `HELIX_RUNTIME` environment variable.
|
||||
|
@ -11,7 +11,6 @@ homepage = "https://helix-editor.com"
|
||||
include = ["src/**/*", "README.md"]
|
||||
|
||||
[features]
|
||||
embed_runtime = ["rust-embed"]
|
||||
|
||||
[dependencies]
|
||||
helix-syntax = { version = "0.3", path = "../helix-syntax" }
|
||||
@ -34,7 +33,6 @@ toml = "0.5"
|
||||
similar = "1.3"
|
||||
|
||||
etcetera = "0.3"
|
||||
rust-embed = { version = "5.9.0", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
quickcheck = { version = "1", default-features = false }
|
||||
|
@ -58,7 +58,6 @@ pub fn find_root(root: Option<&str>) -> Option<std::path::PathBuf> {
|
||||
None
|
||||
}
|
||||
|
||||
#[cfg(not(embed_runtime))]
|
||||
pub fn runtime_dir() -> std::path::PathBuf {
|
||||
if let Ok(dir) = std::env::var("HELIX_RUNTIME") {
|
||||
return dir.into();
|
||||
|
@ -84,7 +84,6 @@ pub struct IndentQuery {
|
||||
pub outdent: HashSet<String>,
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "embed_runtime"))]
|
||||
fn load_runtime_file(language: &str, filename: &str) -> Result<String, std::io::Error> {
|
||||
let path = crate::RUNTIME_DIR
|
||||
.join("queries")
|
||||
@ -93,34 +92,6 @@ fn load_runtime_file(language: &str, filename: &str) -> Result<String, std::io::
|
||||
std::fs::read_to_string(&path)
|
||||
}
|
||||
|
||||
#[cfg(feature = "embed_runtime")]
|
||||
fn load_runtime_file(language: &str, filename: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[derive(rust_embed::RustEmbed)]
|
||||
#[folder = "../runtime/"]
|
||||
struct Runtime;
|
||||
|
||||
#[derive(Debug)]
|
||||
struct EmbeddedFileNotFoundError {
|
||||
path: PathBuf,
|
||||
}
|
||||
impl std::error::Error for EmbeddedFileNotFoundError {}
|
||||
impl fmt::Display for EmbeddedFileNotFoundError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "failed to load embedded file {}", self.path.display())
|
||||
}
|
||||
}
|
||||
|
||||
let path = PathBuf::from("queries").join(language).join(filename);
|
||||
|
||||
if let Some(query_bytes) = Runtime::get(&path.display().to_string()) {
|
||||
String::from_utf8(query_bytes.to_vec()).map_err(|err| err.into())
|
||||
} else {
|
||||
Err(Box::new(EmbeddedFileNotFoundError { path }))
|
||||
}
|
||||
}
|
||||
|
||||
fn read_query(language: &str, filename: &str) -> String {
|
||||
static INHERITS_REGEX: Lazy<Regex> =
|
||||
Lazy::new(|| Regex::new(r";+\s*inherits\s*:?\s*([a-z_,()]+)\s*").unwrap());
|
||||
|
@ -15,7 +15,6 @@ build = true
|
||||
app = true
|
||||
|
||||
[features]
|
||||
embed_runtime = ["helix-core/embed_runtime"]
|
||||
|
||||
[[bin]]
|
||||
name = "hx"
|
||||
|
Loading…
Reference in New Issue
Block a user