on master help sign in
hack: make queries load relative to source dir for now.

We want to provide a runtime dir later on.

commitf0d49d3ca4535a8c22a4ca4038e889560723ec74 authorBlaž Hrastnik <blaz@mxxn.io> dateWed 7 Apr 2021, 18:05 (6 years ago) parent12961d6
2 files changed+6−4
helix-core/src/syntax.rs+4−2 helix-term/src/ui/editor.rs+2−2
helix-core/src/syntax.rs+4−2
@@ -65,12 +65,14 @@ impl LanguageConfiguration {
6565 .get_or_init(|| {
6666 // let name = get_language_name(&self.language_id);
6767
68+ let root = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
69+
6870 let highlights_query =
69− std::fs::read_to_string(self.path.join("queries/highlights.scm"))
71+ std::fs::read_to_string(root.join(&self.path).join("queries/highlights.scm"))
7072 .unwrap_or_default();
7173
7274 let injections_query =
73− std::fs::read_to_string(self.path.join("queries/injections.scm"))
75+ std::fs::read_to_string(root.join(&self.path).join("queries/injections.scm"))
7476 .unwrap_or_default();
7577
7678 let locals_query = "";
helix-term/src/ui/editor.rs+2−2
@@ -233,7 +233,7 @@ impl EditorView {
233233 // TODO: render also if only one of the ranges is in viewport
234234 let mut start = view.screen_coords_at_pos(doc, text, selection.anchor);
235235 let mut end = view.screen_coords_at_pos(doc, text, selection.head);
236−
236+
237237 let head = end;
238238
239239 if selection.head < selection.anchor {
@@ -282,7 +282,7 @@ impl EditorView {
282282 selection_style,
283283 );
284284 }
285−
285+
286286 // cursor
287287 if let Some(head) = head {
288288 surface.set_style(