SourceSpan.messageMultiple()(both extension methods),
FileSpan.highlight()would crash for spans that covered a trailing newline and a single additional empty line.
FileSpan.highlight()now properly highlights point spans at the beginning of lines.
FileSpan.highlight()would put the highlight indicator in the wrong position when highlighting a point span after the end of a file.
SourceFile.span() now goes to the end of the file by default, rather than ending one character before the end of the file. This matches the documented behavior.
FileSpan.context now includes the full line on which the span appears for empty spans at the beginning and end of lines.
Fix an edge case where
FileSpan.highlight() could crash when highlighting a span that ended with an empty line.
Produce better source span highlights for multi-line spans that cover the entire last line of the span, including the newline.
Produce better source span highlights for spans that contain Windows-style newlines.
Improve the output of
<3.0.0, and adjust other dependencies.
new SourceFile() constructor is deprecated. This constructed a source file from a string's runes, rather than its code units, which runs counter to the way Dart handles strings otherwise. The
new StringFile.fromString() constructor (see below) should be used instead.
new SourceFile.fromString() constructor was added. This works like
new SourceFile(), except it uses code units rather than runes.
The current behavior when characters larger than
0xFFFF are passed to
new SourceFile.decoded() is now considered deprecated.
SourceSpan.highlight(), which returns just the highlighted text that would be included in
SourceSpanWithContext.contextto be overridden in strong mode.
FileSpan.end. In 1.2.0 these were mistakenly changed from
SourceLocation directly is deprecated. Instead, extend the new
SourceLocationBase class or mix in the new
Dramatically improve the performance of
SourceFilewhen repeatedly called.
FileSpan.unioncould throw an exception for external implementations of
==, but not
FileSpan.expand no longer throw exceptions for external implementations of
FileSpan.hashCode now fully agrees with
SourceSpanWithContextto allow multiple occurrences of
FileSpan's context to include the full span text, not just the first line of it.
SourceSpanWithContext: a span that also includes the full line of text that contains the span.
Avoid unintentionally allocating extra objects for internal
SourceSpan.operator== works on arbitrary
This package was extracted from the
source_maps package, but the API has many differences. Among them:
Span has been renamed to
Location has been renamed to
SourceLocation to clarify their purpose and maintain consistency with the package name. Likewise,
SpanException is now
SpanFormatException is not
FixedLocation have been rolled into the
Location classes, respectively.
SourceFile is more aggressive about validating its arguments. Out-of-bounds lines, columns, and offsets will now throw errors rather than be silently clamped.
SourceFile.url now return
Uri objects rather than
Strings. The constructors allow either
SourceFile.getLocationMessage are now
SourceFile.message, respectively. Rather than taking both a
useColor and a
color parameter, they now take a single
color parameter that controls both whether and which color is used.
Span.isIdentifier has been removed. This property doesn't make sense outside of a source map context.
SourceFileSegment has been removed. This class wasn't widely used and was inconsistent in its choice of which parameters were considered relative and which absolute.