Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust diagnostics reporter closure argument #1175

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 41 additions & 58 deletions Cargo.lock

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

44 changes: 22 additions & 22 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,28 @@ assert_fs = "1"
async-trait = "0.1"
axum = { version = "0.6", features = ["http2"] }
cairo-felt = "0.9.1"
cairo-lang-casm = "2.6.0"
cairo-lang-compiler = "2.6.0"
cairo-lang-debug = "2.6.0"
cairo-lang-defs = "2.6.0"
cairo-lang-diagnostics = "2.6.0"
cairo-lang-filesystem = "2.6.0"
cairo-lang-formatter = "2.6.0"
cairo-lang-language-server = "2.6.0"
cairo-lang-lowering = "2.6.0"
cairo-lang-project = "2.6.0"
cairo-lang-runner = "2.6.0"
cairo-lang-semantic = "2.6.0"
cairo-lang-sierra = "2.6.0"
cairo-lang-sierra-generator = "2.6.0"
cairo-lang-sierra-to-casm = "2.6.0"
cairo-lang-sierra-type-size = "2.6.0"
cairo-lang-starknet = "2.6.0"
cairo-lang-starknet-classes = "2.6.0"
cairo-lang-syntax = "2.6.0"
cairo-lang-test-plugin = "2.6.0"
cairo-lang-test-runner = "2.6.0"
cairo-lang-utils = { version = "2.6.0", features = ["env_logger"] }
cairo-lang-casm = { git = "https://github.com/starkware-libs/cairo", rev = "8e47925be7c91e7500bc5827c9e8f7f401985f3e" }
cairo-lang-compiler = { git = "https://github.com/starkware-libs/cairo", rev = "8e47925be7c91e7500bc5827c9e8f7f401985f3e" }
cairo-lang-debug = { git = "https://github.com/starkware-libs/cairo", rev = "8e47925be7c91e7500bc5827c9e8f7f401985f3e" }
cairo-lang-defs = { git = "https://github.com/starkware-libs/cairo", rev = "8e47925be7c91e7500bc5827c9e8f7f401985f3e" }
cairo-lang-diagnostics = { git = "https://github.com/starkware-libs/cairo", rev = "8e47925be7c91e7500bc5827c9e8f7f401985f3e" }
cairo-lang-filesystem = { git = "https://github.com/starkware-libs/cairo", rev = "8e47925be7c91e7500bc5827c9e8f7f401985f3e" }
cairo-lang-formatter = { git = "https://github.com/starkware-libs/cairo", rev = "8e47925be7c91e7500bc5827c9e8f7f401985f3e" }
cairo-lang-language-server = { git = "https://github.com/starkware-libs/cairo", rev = "8e47925be7c91e7500bc5827c9e8f7f401985f3e" }
cairo-lang-lowering = { git = "https://github.com/starkware-libs/cairo", rev = "8e47925be7c91e7500bc5827c9e8f7f401985f3e" }
cairo-lang-project = { git = "https://github.com/starkware-libs/cairo", rev = "8e47925be7c91e7500bc5827c9e8f7f401985f3e" }
cairo-lang-runner = { git = "https://github.com/starkware-libs/cairo", rev = "8e47925be7c91e7500bc5827c9e8f7f401985f3e" }
cairo-lang-semantic = { git = "https://github.com/starkware-libs/cairo", rev = "8e47925be7c91e7500bc5827c9e8f7f401985f3e" }
cairo-lang-sierra = { git = "https://github.com/starkware-libs/cairo", rev = "8e47925be7c91e7500bc5827c9e8f7f401985f3e" }
cairo-lang-sierra-generator = { git = "https://github.com/starkware-libs/cairo", rev = "8e47925be7c91e7500bc5827c9e8f7f401985f3e" }
cairo-lang-sierra-to-casm = { git = "https://github.com/starkware-libs/cairo", rev = "8e47925be7c91e7500bc5827c9e8f7f401985f3e" }
cairo-lang-sierra-type-size = { git = "https://github.com/starkware-libs/cairo", rev = "8e47925be7c91e7500bc5827c9e8f7f401985f3e" }
cairo-lang-starknet = { git = "https://github.com/starkware-libs/cairo", rev = "8e47925be7c91e7500bc5827c9e8f7f401985f3e" }
cairo-lang-starknet-classes = { git = "https://github.com/starkware-libs/cairo", rev = "8e47925be7c91e7500bc5827c9e8f7f401985f3e" }
cairo-lang-syntax = { git = "https://github.com/starkware-libs/cairo", rev = "8e47925be7c91e7500bc5827c9e8f7f401985f3e" }
cairo-lang-test-plugin = { git = "https://github.com/starkware-libs/cairo", rev = "8e47925be7c91e7500bc5827c9e8f7f401985f3e" }
cairo-lang-test-runner = { git = "https://github.com/starkware-libs/cairo", rev = "8e47925be7c91e7500bc5827c9e8f7f401985f3e" }
cairo-lang-utils = { git = "https://github.com/starkware-libs/cairo", rev = "8e47925be7c91e7500bc5827c9e8f7f401985f3e", features = ["env_logger"] }
camino = { version = "1", features = ["serde1"] }
cargo_metadata = ">=0.18"
clap = { version = "4", features = ["derive", "env", "string"] }
Expand Down
12 changes: 7 additions & 5 deletions scarb/src/compiler/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use anyhow::{Context, Result};
use cairo_lang_compiler::db::RootDatabase;
use cairo_lang_compiler::diagnostics::DiagnosticsReporter;
use cairo_lang_compiler::CompilerConfig;
use cairo_lang_diagnostics::Severity;
use cairo_lang_diagnostics::{FormattedDiagnosticEntry, Severity};
use cairo_lang_filesystem::db::FilesGroup;
use cairo_lang_filesystem::ids::{CrateId, CrateLongId};
use serde::Serialize;
Expand All @@ -21,10 +21,12 @@ pub fn build_compiler_config<'c>(
let diagnostics_reporter = DiagnosticsReporter::callback({
let config = ws.config();

|severity: Severity, diagnostic: String| {
let msg = diagnostic.clone();
let msg = msg.strip_suffix('\n').unwrap_or(diagnostic.as_str());
match severity {
|entry: FormattedDiagnosticEntry| {
let msg = entry
.message()
.strip_suffix('\n')
.unwrap_or(entry.message());
match entry.severity() {
Severity::Error => config.ui().error(msg),
Severity::Warning => config.ui().warn(msg),
};
Expand Down
Loading