fix: syntax highlighting was broken in bundled app
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
fn main() {
|
||||
// syntect and fastembed both reach onig_sys across separate Rust dylibs.
|
||||
// Keep the vendored static archive on this dylib's final native link line.
|
||||
if std::env::var("CARGO_CFG_TARGET_ENV").as_deref() == Ok("msvc") {
|
||||
println!("cargo:rustc-link-arg=onig.lib");
|
||||
} else {
|
||||
println!("cargo:rustc-link-arg=-lonig");
|
||||
}
|
||||
}
|
||||
26
crates/bds-ui/tests/bundled_highlighting.rs
Normal file
26
crates/bds-ui/tests/bundled_highlighting.rs
Normal file
@@ -0,0 +1,26 @@
|
||||
use std::collections::HashSet;
|
||||
|
||||
#[test]
|
||||
fn linked_editor_highlights_markdown() {
|
||||
// Retain the dylib that previously interposed bds-editor's regex symbols.
|
||||
let _ = std::hint::black_box(
|
||||
bds_server::run_headless
|
||||
as fn(bds_server::boot::BootMode, bds_server::ServerConfig) -> anyhow::Result<()>,
|
||||
);
|
||||
let highlighter = bds_editor::highlighter();
|
||||
assert_eq!(
|
||||
highlighter.syntax_for_extension("md").name,
|
||||
"Markdown with Macros"
|
||||
);
|
||||
let colors = highlighter
|
||||
.highlight_lines(
|
||||
"plain\n# Heading\n[link](https://example.com)\n`code`",
|
||||
highlighter.syntax_for_extension("md"),
|
||||
)
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.map(|(style, _)| style.foreground)
|
||||
.collect::<HashSet<_>>();
|
||||
|
||||
assert!(colors.len() > 1, "linked editor should use syntax colors");
|
||||
}
|
||||
Reference in New Issue
Block a user