Skip to content

Commit

Permalink
Add missing ariadne config to ReportBuilder (#522)
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobSteinberg committed Sep 24, 2024
1 parent bc7d957 commit 28c93d8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion nemo/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub mod span;

use std::{cell::RefCell, ops::Range, rc::Rc};

use ariadne::{Color, Label, Report, ReportKind, Source};
use ariadne::{Color, Config, Label, Report, ReportKind, Source};
use ast::{program::Program, ProgramAST};
use error::{ParserError, ParserErrorTree};
use input::ParserInput;
Expand Down Expand Up @@ -82,6 +82,7 @@ impl<'a> ParserErrorReport<'a> {
.with_message(message)
.with_color(Color::Red),
)
.with_config(Config::default().with_index_type(ariadne::IndexType::Byte))
.finish()
})
}
Expand Down
12 changes: 7 additions & 5 deletions nemo/src/rule_model/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,13 @@ where
ComplexErrorLabelKind::Information => Color::BrightBlue,
};

report = report.with_label(
Label::new((source_label.clone(), translation(&label.reference)))
.with_message(label.message.clone())
.with_color(color),
);
report = report
.with_label(
Label::new((source_label.clone(), translation(&label.reference)))
.with_message(label.message.clone())
.with_color(color),
)
.with_config(Config::default().with_index_type(ariadne::IndexType::Byte));
}

for hint in &self.hints {
Expand Down

0 comments on commit 28c93d8

Please sign in to comment.