我正在使用EGUI在Rust中编辑文本编辑器。我正在尝试实现语法突出显示,
因此,我在 syntax_highlighting 。我有Syntect和Egui都安装了他们的最新版本,并拥有它们
作为依赖。
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)
};
特别是,正是这些行引起的错误是在板条箱根中找不到 stytax_highlighting
。如果有用,这是我的所有代码:
https://pastebin.com/mhdhlhsr
我想对我的egui应用程序进行启发,但是我发现 stytax_highlighting
在板条箱根中找不到的错误,我找到的唯一示例使用了。
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.
发布评论
评论(1)
板条::
表示syntax_highlighting
是egui_demo_lib
板条本身的成员。 In this case, you'll find it right here。The
crate::
meanssyntax_highlighting
is a member of theegui_demo_lib
crate itself. In this case, you'll find it right here.