I'm writing a text editor in Rust using egui. I am trying to implement syntax highlighting,
so I followed the example in the demo. It works there, so I thought it might be useful. But I am getting an error that syntax_highlighting
is not found in the crate root. I have syntect and egui both installed at their latest versions and have them
as dependencies.
let mut theme = crate::syntax_highlighting::CodeTheme::from_memory(ui.ctx());
ui.collapsing("Theme", |ui| {
ui.group(|ui| {
theme.ui(ui);
theme.clone().store_in_memory(ui.ctx());
});
});
let mut layouter = |ui: &egui::Ui, string: &str, wrap_width: f32| {
let mut layout_job =
crate::syntax_highlighting::highlight(ui.ctx(), &theme, string, self.language);
layout_job.wrap.max_width = wrap_width;
ui.fonts().layout_job(layout_job)
};
In particular, it is these lines that raise the error that syntax_highlighting
is not found in the crate root. In case it's useful, here is all my code:
https://pastebin.com/mHDhLhSR
I want to implement syntax highlighting to my egui application, but I get the error that syntax_highlighting
is not found in the crate root, which the only example I found used.