From 805c943964ca8f40e55e37f5f1f6867d326f668f Mon Sep 17 00:00:00 2001 From: Canop Date: Fri, 3 Jan 2025 08:06:23 +0100 Subject: [PATCH] update syntect-no-panic --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- bacon.toml | 11 +++++++++++ src/syntactic/syntaxer.rs | 10 ++++++++-- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cd4cc292..2312c974 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2673,9 +2673,9 @@ dependencies = [ [[package]] name = "syntect-no-panic" -version = "5.2.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5dfd0574cec0f1144db6f3cfaed22adcadb3d1e24fbf75754e46aa411d08de" +checksum = "d5a48fbacf5de9abade2f665fba57c35d1297e9c7c10dbc906873589de3ca4c6" dependencies = [ "bincode", "bitflags 1.3.2", diff --git a/Cargo.toml b/Cargo.toml index d9d86b20..179347d9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,7 +57,7 @@ serde = { version = "1.0", features = ["derive"] } smallvec = "1.11" # version 2 is still alpha splitty = "1.0.2" strict = "0.1.4" -syntect = { package = "syntect-no-panic", version = "5.2", default-features = false, features = ["default-fancy"] } # see https://github.com/Canop/broot/pull/968 +syntect = { package = "syntect-no-panic", version = "6.0", default-features = false, features = ["default-fancy"] } # see https://github.com/Canop/broot/pull/968 tempfile = "3.2" termimad = "0.31" terminal-clipboard = { version = "0.4.1", optional = true } diff --git a/bacon.toml b/bacon.toml index 6533bcb6..d57c6397 100644 --- a/bacon.toml +++ b/bacon.toml @@ -11,6 +11,17 @@ command = ["cargo", "check", "--all-targets"] need_stdout = false watch = ["tests", "benches", "examples"] +[jobs.bacon-ls] +command = [ "cargo", "check", "--message-format", "json-diagnostic-rendered-ansi" ] +analyzer = "cargo_json" +need_stdout = true + +[exports.cargo-json-spans] +auto = true +exporter = "analyzer" +line_format = "{diagnostic.level}:{span.file_name}:{span.line_start}:{span.line_end}:{diagnostic.message}" +path = "bacon-analyzzzer.json" + [jobs.check] command = [ "cargo", "check", diff --git a/src/syntactic/syntaxer.rs b/src/syntactic/syntaxer.rs index 2aa2a135..ec782168 100644 --- a/src/syntactic/syntaxer.rs +++ b/src/syntactic/syntaxer.rs @@ -5,7 +5,10 @@ use { once_cell::sync::Lazy, std::path::Path, syntect::{ - easy::HighlightLines, + easy::{ + HighlightLines, + HighlightOptions, + }, parsing::SyntaxSet, highlighting::{Theme, ThemeSet}, }, @@ -51,7 +54,10 @@ impl Syntaxer { let theme = con.syntax_theme.unwrap_or_default(); let theme = self.theme_set.themes.get(theme.syntect_name()) .unwrap_or_else(|| self.theme_set.themes.iter().next().unwrap().1); - HighlightLines::new(syntax, theme) + let options = HighlightOptions { + ignore_errors: true, + }; + HighlightLines::new(syntax, theme, options) }) } }