Skip to content

Commit

Permalink
fix rhai error positioning
Browse files Browse the repository at this point in the history
  • Loading branch information
BrettMayson committed Oct 24, 2024
1 parent 7da3f47 commit 830a610
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions bin/src/modules/hook/error/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ pub mod bhe4_runtime_error;
fn get_offset(content: &str, location: Position) -> usize {
let mut offset = 0;
for (i, line) in content.lines().enumerate() {
if i == location.line().expect("location should have a line number") {
if i + 1 == location.line().expect("location should have a line number") {
offset += location
.position()
.expect("location should have a column number");
.expect("location should have a column number") - 1;
break;
}
offset += line.len() + 1;
Expand Down
3 changes: 2 additions & 1 deletion bin/src/modules/sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use hemtt_workspace::{
addons::Location,
reporting::{Code, Diagnostic},
};
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};

use crate::{context::Context, error::Error, report::Report};

Expand Down Expand Up @@ -76,7 +77,7 @@ impl Module for Sign {
.join("keys")
.join(format!("{authority}.bikey")),
)?)?;
ctx.addons().to_vec().iter().try_for_each(|addon| {
ctx.addons().to_vec().par_iter().try_for_each(|addon| {
let pbo_name = addon.pbo_name(ctx.config().prefix());
let (mut pbo, sig_location, key) = match addon.location() {
Location::Addons => {
Expand Down

0 comments on commit 830a610

Please sign in to comment.