mirror of
https://github.com/nushell/nushell.git
synced 2025-08-14 12:59:12 +02:00
Move from language-reporting to codespan (#1825)
This commit is contained in:
@ -13,7 +13,7 @@ doctest = false
|
||||
serde = { version = "1.0.106", features = ["derive"] }
|
||||
derive-new = "0.5.8"
|
||||
getset = "0.1.1"
|
||||
language-reporting = "0.4.0"
|
||||
codespan-reporting = "0.9.4"
|
||||
termcolor = "1.1.0"
|
||||
pretty = "0.5.2"
|
||||
|
||||
|
@ -472,6 +472,15 @@ impl From<Option<Span>> for Span {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Span> for std::ops::Range<usize> {
|
||||
fn from(input: Span) -> std::ops::Range<usize> {
|
||||
std::ops::Range {
|
||||
start: input.start,
|
||||
end: input.end,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Span {
|
||||
/// Creates a default new `Span` that has 0 start and 0 end.
|
||||
pub fn default() -> Self {
|
||||
@ -657,32 +666,6 @@ impl PartialEq<usize> for Span {
|
||||
}
|
||||
}
|
||||
|
||||
impl language_reporting::ReportingSpan for Span {
|
||||
fn with_start(&self, start: usize) -> Self {
|
||||
if self.end < start {
|
||||
Span::new(start, start)
|
||||
} else {
|
||||
Span::new(start, self.end)
|
||||
}
|
||||
}
|
||||
|
||||
fn with_end(&self, end: usize) -> Self {
|
||||
if end < self.start {
|
||||
Span::new(end, end)
|
||||
} else {
|
||||
Span::new(self.start, end)
|
||||
}
|
||||
}
|
||||
|
||||
fn start(&self) -> usize {
|
||||
self.start
|
||||
}
|
||||
|
||||
fn end(&self) -> usize {
|
||||
self.end
|
||||
}
|
||||
}
|
||||
|
||||
pub trait IntoSpanned {
|
||||
type Output: HasFallibleSpan;
|
||||
|
||||
|
Reference in New Issue
Block a user