hack: make queries load relative to source dir for now.

We want to provide a runtime dir later on.
This commit is contained in:
Blaž Hrastnik 2021-04-07 18:05:59 +09:00
parent 12961d657f
commit f0d49d3ca4
2 changed files with 6 additions and 4 deletions

View file

@ -65,12 +65,14 @@ impl LanguageConfiguration {
.get_or_init(|| {
// let name = get_language_name(&self.language_id);
let root = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
let highlights_query =
std::fs::read_to_string(self.path.join("queries/highlights.scm"))
std::fs::read_to_string(root.join(&self.path).join("queries/highlights.scm"))
.unwrap_or_default();
let injections_query =
std::fs::read_to_string(self.path.join("queries/injections.scm"))
std::fs::read_to_string(root.join(&self.path).join("queries/injections.scm"))
.unwrap_or_default();
let locals_query = "";

View file

@ -233,7 +233,7 @@ impl EditorView {
// TODO: render also if only one of the ranges is in viewport
let mut start = view.screen_coords_at_pos(doc, text, selection.anchor);
let mut end = view.screen_coords_at_pos(doc, text, selection.head);
let head = end;
if selection.head < selection.anchor {
@ -282,7 +282,7 @@ impl EditorView {
selection_style,
);
}
// cursor
if let Some(head) = head {
surface.set_style(