on master help sign in
Apply suggestions from code review
ae10581Brian Dawn
README.md+1−2
@@ -45,7 +45,7 @@ the `HELIX_RUNTIME` environment variable.
45> NOTE: You should set this to <path to repository>/runtime in development (if
45> NOTE: You should set this to <path to repository>/runtime in development (if
46> running via cargo).
46> running via cargo).
47
47
48−If you want to bake the `runtime/` directory into the Helix binary you can build
48+If you want to embed the `runtime/` directory into the Helix binary you can build
49it with:
49it with:
50
50
51```
51```
@@ -82,4 +82,3 @@ All shortcuts/keymaps can be found in the documentation on the website:
82# Getting help
82# Getting help
83
83
84Discuss the project on the community [Matrix Space](https://matrix.to/#/#helix-community:matrix.org) (make sure to join `#helix-editor:matrix.org` if you're on a client that doesn't support Matrix Spaces yet).
84Discuss the project on the community [Matrix Space](https://matrix.to/#/#helix-community:matrix.org) (make sure to join `#helix-editor:matrix.org` if you're on a client that doesn't support Matrix Spaces yet).
85−
book/src/install.md+1−1
@@ -36,7 +36,7 @@ Now copy the `runtime/` directory somewhere. Helix will by default look for the
36runtime inside the same folder as the executable, but that can be overriden via
36runtime inside the same folder as the executable, but that can be overriden via
37the `HELIX_RUNTIME` environment variable.
37the `HELIX_RUNTIME` environment variable.
38
38
39−If you want to bake the `runtime/` directory into the Helix binary you can build
39+If you want to embed the `runtime/` directory into the Helix binary you can build
40it with:
40it with:
41
41
42```
42```
helix-core/src/syntax.rs+2−5
@@ -81,10 +81,7 @@ fn load_runtime_file(language: &str, filename: &str) -> Result<String, std::io::
81}
81}
82
82
83#[cfg(feature = "embed_runtime")]
83#[cfg(feature = "embed_runtime")]
84−use rust_embed::RustEmbed;
84+#[derive(rust_embed::RustEmbed)]
85−
86−#[cfg(feature = "embed_runtime")]
87−#[derive(RustEmbed)]
88#[folder = "../runtime/"]
85#[folder = "../runtime/"]
89struct Runtime;
86struct Runtime;
90
87
@@ -93,7 +90,7 @@ fn load_runtime_file(language: &str, filename: &str) -> Result<String, Box<dyn s
93 let root = PathBuf::new();
90 let root = PathBuf::new();
94 let path = root.join("queries").join(language).join(filename);
91 let path = root.join("queries").join(language).join(filename);
95
92
96− let query_bytes = Runtime::get(&path.as_path().display().to_string()).unwrap_or_default();
93+ let query_bytes = Runtime::get(&path.display().to_string()).unwrap_or_default();
97 std::str::from_utf8(query_bytes.as_ref())
94 std::str::from_utf8(query_bytes.as_ref())
98 .map(|s| s.to_string())
95 .map(|s| s.to_string())
99 .map_err(|err| err.into())
96 .map_err(|err| err.into())