mirror of
https://github.com/nushell/nushell.git
synced 2025-03-22 19:47:08 +01:00
commit
673137be8b
5
Cargo.lock
generated
5
Cargo.lock
generated
@ -339,7 +339,7 @@ checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "miette"
|
name = "miette"
|
||||||
version = "3.0.1-alpha.0"
|
version = "3.0.1-alpha.0"
|
||||||
source = "git+https://github.com/zkat/miette?rev=183ecb9#183ecb9b78a1c22d832e979db5054dcac36d8b7a"
|
source = "git+https://github.com/zkat/miette?branch=release/3.0.0#491ce7c0ce1f04c9b6fc09c250f188c1ec77df53"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"atty",
|
"atty",
|
||||||
"backtrace",
|
"backtrace",
|
||||||
@ -354,13 +354,12 @@ dependencies = [
|
|||||||
"term_size",
|
"term_size",
|
||||||
"textwrap",
|
"textwrap",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"unicode-width",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "miette-derive"
|
name = "miette-derive"
|
||||||
version = "3.0.0-alpha.0"
|
version = "3.0.0-alpha.0"
|
||||||
source = "git+https://github.com/zkat/miette?rev=183ecb9#183ecb9b78a1c22d832e979db5054dcac36d8b7a"
|
source = "git+https://github.com/zkat/miette?branch=release/3.0.0#491ce7c0ce1f04c9b6fc09c250f188c1ec77df53"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -16,7 +16,7 @@ nu-engine = { path="./crates/nu-engine" }
|
|||||||
nu-parser = { path="./crates/nu-parser" }
|
nu-parser = { path="./crates/nu-parser" }
|
||||||
nu-protocol = { path = "./crates/nu-protocol" }
|
nu-protocol = { path = "./crates/nu-protocol" }
|
||||||
nu-table = { path = "./crates/nu-table" }
|
nu-table = { path = "./crates/nu-table" }
|
||||||
miette = { git = "https://github.com/zkat/miette", rev = "183ecb9" }
|
miette = { git = "https://github.com/zkat/miette", branch = "release/3.0.0" }
|
||||||
# miette = { path = "../miette" }
|
# miette = { path = "../miette" }
|
||||||
# mimalloc = { version = "*", default-features = false }
|
# mimalloc = { version = "*", default-features = false }
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ edition = "2018"
|
|||||||
nu-engine = { path = "../nu-engine" }
|
nu-engine = { path = "../nu-engine" }
|
||||||
nu-parser = { path = "../nu-parser" }
|
nu-parser = { path = "../nu-parser" }
|
||||||
nu-protocol = { path = "../nu-protocol" }
|
nu-protocol = { path = "../nu-protocol" }
|
||||||
miette = { git = "https://github.com/zkat/miette", rev = "183ecb9", features = ["fancy"] }
|
miette = { git = "https://github.com/zkat/miette", branch = "release/3.0.0", features = ["fancy"] }
|
||||||
# miette = { path = "../../../miette", features = ["fancy"] }
|
# miette = { path = "../../../miette", features = ["fancy"] }
|
||||||
thiserror = "1.0.29"
|
thiserror = "1.0.29"
|
||||||
nu-ansi-term = "0.36.0"
|
nu-ansi-term = "0.36.0"
|
||||||
|
@ -4,7 +4,7 @@ version = "0.1.0"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
miette = { git = "https://github.com/zkat/miette", rev = "183ecb9" }
|
miette = { git = "https://github.com/zkat/miette", branch = "release/3.0.0" }
|
||||||
# miette = { path = "../../../miette" }
|
# miette = { path = "../../../miette" }
|
||||||
thiserror = "1.0.29"
|
thiserror = "1.0.29"
|
||||||
nu-protocol = { path = "../nu-protocol"}
|
nu-protocol = { path = "../nu-protocol"}
|
||||||
|
@ -7,5 +7,5 @@ edition = "2018"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
thiserror = "1.0.29"
|
thiserror = "1.0.29"
|
||||||
miette = { git = "https://github.com/zkat/miette", rev = "183ecb9" }
|
miette = { git = "https://github.com/zkat/miette", branch = "release/3.0.0" }
|
||||||
# miette = { path = "../../../miette" }
|
# miette = { path = "../../../miette" }
|
||||||
|
@ -556,8 +556,20 @@ impl<'a> miette::SourceCode for &StateWorkingSet<'a> {
|
|||||||
context_lines_before: usize,
|
context_lines_before: usize,
|
||||||
context_lines_after: usize,
|
context_lines_after: usize,
|
||||||
) -> Result<Box<dyn miette::SpanContents + 'b>, miette::MietteError> {
|
) -> Result<Box<dyn miette::SpanContents + 'b>, miette::MietteError> {
|
||||||
|
let debugging = std::env::var("MIETTE_DEBUG").is_ok();
|
||||||
|
if debugging {
|
||||||
|
let finding_span = "Finding span in StateWorkingSet";
|
||||||
|
dbg!(finding_span, span);
|
||||||
|
}
|
||||||
for (filename, start, end) in self.files() {
|
for (filename, start, end) in self.files() {
|
||||||
|
if debugging {
|
||||||
|
dbg!(&filename, start, end);
|
||||||
|
}
|
||||||
if span.offset() >= *start && span.offset() + span.len() <= *end {
|
if span.offset() >= *start && span.offset() + span.len() <= *end {
|
||||||
|
if debugging {
|
||||||
|
let found_file = "Found matching file";
|
||||||
|
dbg!(found_file);
|
||||||
|
}
|
||||||
let our_span = Span {
|
let our_span = Span {
|
||||||
start: *start,
|
start: *start,
|
||||||
end: *end,
|
end: *end,
|
||||||
@ -565,7 +577,13 @@ impl<'a> miette::SourceCode for &StateWorkingSet<'a> {
|
|||||||
// We need to move to a local span because we're only reading
|
// We need to move to a local span because we're only reading
|
||||||
// the specific file contents via self.get_span_contents.
|
// the specific file contents via self.get_span_contents.
|
||||||
let local_span = (span.offset() - *start, span.len()).into();
|
let local_span = (span.offset() - *start, span.len()).into();
|
||||||
|
if debugging {
|
||||||
|
dbg!(&local_span);
|
||||||
|
}
|
||||||
let span_contents = self.get_span_contents(our_span);
|
let span_contents = self.get_span_contents(our_span);
|
||||||
|
if debugging {
|
||||||
|
dbg!(String::from_utf8_lossy(span_contents));
|
||||||
|
}
|
||||||
let span_contents = span_contents.read_span(
|
let span_contents = span_contents.read_span(
|
||||||
&local_span,
|
&local_span,
|
||||||
context_lines_before,
|
context_lines_before,
|
||||||
@ -574,19 +592,31 @@ impl<'a> miette::SourceCode for &StateWorkingSet<'a> {
|
|||||||
let content_span = span_contents.span();
|
let content_span = span_contents.span();
|
||||||
// Back to "global" indexing
|
// Back to "global" indexing
|
||||||
let retranslated = (content_span.offset() + start, content_span.len()).into();
|
let retranslated = (content_span.offset() + start, content_span.len()).into();
|
||||||
|
if debugging {
|
||||||
|
dbg!(&retranslated);
|
||||||
|
}
|
||||||
|
|
||||||
|
let data = span_contents.data();
|
||||||
if filename == "<cli>" {
|
if filename == "<cli>" {
|
||||||
|
if debugging {
|
||||||
|
let success_cli = "Successfully read CLI span";
|
||||||
|
dbg!(success_cli, String::from_utf8_lossy(data));
|
||||||
|
}
|
||||||
return Ok(Box::new(miette::MietteSpanContents::new(
|
return Ok(Box::new(miette::MietteSpanContents::new(
|
||||||
span_contents.data(),
|
data,
|
||||||
retranslated,
|
retranslated,
|
||||||
span_contents.line(),
|
span_contents.line(),
|
||||||
span_contents.column(),
|
span_contents.column(),
|
||||||
span_contents.line_count(),
|
span_contents.line_count(),
|
||||||
)));
|
)));
|
||||||
} else {
|
} else {
|
||||||
|
if debugging {
|
||||||
|
let success_file = "Successfully read file span";
|
||||||
|
dbg!(success_file);
|
||||||
|
}
|
||||||
return Ok(Box::new(miette::MietteSpanContents::new_named(
|
return Ok(Box::new(miette::MietteSpanContents::new_named(
|
||||||
filename.clone(),
|
filename.clone(),
|
||||||
span_contents.data(),
|
data,
|
||||||
retranslated,
|
retranslated,
|
||||||
span_contents.line(),
|
span_contents.line(),
|
||||||
span_contents.column(),
|
span_contents.column(),
|
||||||
|
Loading…
Reference in New Issue
Block a user