Skip to content

Commit

Permalink
update syntect-no-panic
Browse files Browse the repository at this point in the history
  • Loading branch information
Canop committed Jan 3, 2025
1 parent ec265a7 commit 805c943
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
11 changes: 11 additions & 0 deletions bacon.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 8 additions & 2 deletions src/syntactic/syntaxer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ use {
once_cell::sync::Lazy,
std::path::Path,
syntect::{
easy::HighlightLines,
easy::{
HighlightLines,
HighlightOptions,
},
parsing::SyntaxSet,
highlighting::{Theme, ThemeSet},
},
Expand Down Expand Up @@ -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)
})
}
}

0 comments on commit 805c943

Please sign in to comment.