Skip to content

Merge package:source_span #1263

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

Merged
merged 137 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
137 commits
Select commit Hold shift + click to select a range
8105a5e
Extract out a source_span package from source_maps.
nex3 Jul 18, 2014
4990ab2
Change "FormatException.position" to be named "offset".
lrhn Jul 18, 2014
3db3d33
Use a more compact internal representation for FileSpan.
nex3 Nov 7, 2014
5d7bc2c
Fix source_span tests.
nex3 Nov 7, 2014
9abb096
Avoid instantiating FileLocations where possible in source_span.
nex3 Nov 21, 2014
2b3e040
Add gitignore, status, and codereview files.
nex3 Dec 18, 2014
98f02e2
Update the pubspec's homepage link.
nex3 Dec 18, 2014
bda022d
Cleanup equality operator to accept any Object rather than just a Sou…
jacob314 Jan 27, 2015
13fb954
Introduce span with line context
sigmundch Mar 26, 2015
21cddeb
Fix library name (dartanalyzer was complaining in the bots)
sigmundch Mar 26, 2015
c755707
Fix FileSpan.context to include FileSpan.text.
sigmundch Mar 27, 2015
0e4e3ff
Support multiple occurrences of text in context
sigmundch Mar 31, 2015
1836731
Upgrade to the new test runner.
nex3 Jul 16, 2015
e6834f3
Support external implementations of FileSpan.
nex3 Aug 18, 2015
433b998
Eliminate dart2js warning about overriding `==`, but not `hashCode`.
kevmoo Aug 28, 2015
b1e9d75
Make the package strong-mode clean.
nex3 Sep 1, 2015
445aa0e
Optimize successive calls SourceFile.getLine().
munificent Sep 2, 2015
b7846b0
Bump version.
munificent Sep 2, 2015
7d0ff86
Fix a performance bug with FileLocation.
nex3 Sep 2, 2015
e61c7fd
Add SourceLocationMixin and SourceLocationBase.
nex3 Sep 2, 2015
57c51dd
Fix the typing of FileSpan.{start,end}.
nex3 Sep 30, 2015
ee812d5
Get rid of all the library tags.
nex3 Jan 13, 2016
64d82ca
Make SourceSpanException.source a getter
vsmenon Feb 23, 2016
cf91b57
Allow some fields to be overridden in strong mode.
nex3 Mar 2, 2016
039fc63
Declare the package strong-mode clean.
nex3 May 4, 2016
8732d80
Fix a message bug.
nex3 Jun 9, 2016
825a024
fix new strong mode error
jakemac53 Oct 17, 2016
9b64b57
update pubspec/changelog for 1.2.4
jakemac53 Oct 17, 2016
3397c1d
Merge pull request dart-lang/source_span#9 from dart-lang/fix-strong-…
jakemac53 Oct 17, 2016
1efa400
Add SourceSpan.highlight(). (dart-lang/source_span#10)
nex3 Nov 8, 2016
0158800
Fix tab highlighting. (dart-lang/source_span#14)
nex3 Jan 7, 2017
2829c38
Update the SDK constraint. (dart-lang/source_span#15)
nex3 Jan 7, 2017
4d62afa
Deprecate the use of runes in SourceFile. (dart-lang/source_span#16)
nex3 May 17, 2017
3f8bd49
Enable Travis-CI (dart-lang/source_span#19)
kevmoo Mar 1, 2018
67cb712
Update .gitignore to new `dart_tool` pub cache
bcko May 24, 2018
38f80e2
Avoid uninitialized final fields. (dart-lang/source_span#22)
askeksa Jul 6, 2018
4359f93
chore: set max SDK version to <3.0.0 (dart-lang/source_span#23)
chalin Jul 18, 2018
328a916
Fix typo and add example to message() and highlight() (dart-lang/sour…
srawlins Dec 13, 2018
c084ccd
Improve span highlighting
nex3 Dec 20, 2018
1073d5e
Add a missing import
nex3 Dec 20, 2018
855d5ec
Code review
nex3 Dec 26, 2018
8aba87e
Format
nex3 Jan 10, 2019
98b05ae
More code review
nex3 Jan 10, 2019
a88c152
Merge pull request dart-lang/source_span#25 from dart-lang/better-hig…
nex3 Jan 10, 2019
ecec3a2
Improve FileSpan.context
nex3 Jan 12, 2019
219ded1
Make sure all full-line spans are highlighted properly
nex3 Jan 12, 2019
8bb0c14
Mark this as a dev version
nex3 Jan 12, 2019
db2abe7
Merge pull request dart-lang/source_span#26 from dart-lang/tweak-high…
nex3 Jan 12, 2019
dbe9b97
Refactor highlighter normalizations
nex3 Jan 12, 2019
d57354a
Produce better highlights for Windows newlines
nex3 Jan 12, 2019
82e4efc
Merge pull request dart-lang/source_span#27 from dart-lang/highlight-…
nex3 Jan 14, 2019
1679e1f
SourceFile.span() should include last char when end offset omitted (d…
evanweible-wf Jan 17, 2019
6978f7e
Make FileSpan.context include the full line for all point spans
nex3 Jan 17, 2019
16c9fd3
Don't crash on spans that end on empty lines
nex3 Jan 17, 2019
f37d19e
Merge pull request dart-lang/source_span#29 from dart-lang/fixes
nex3 Jan 17, 2019
4c07f41
Fix a bug when highlighting an end-of-file point span (dart-lang/sour…
nex3 Jan 24, 2019
96e3b6e
Drop special support for point spans at the end of files (dart-lang/s…
nex3 Jan 29, 2019
e75afea
Fix a highlighting bug (dart-lang/source_span#33)
nex3 Feb 28, 2019
8d99f34
travis: test on the oldest supported SDK (dart-lang/source_span#34)
kevmoo Apr 26, 2019
c793c9f
Merge pull request dart-lang/source_span#20 from bcko/patch-1
mit-mit Jun 19, 2019
77329f5
Delete codereview.settings
kevmoo Aug 1, 2019
a7bc53e
Fix padding around certain line numbers
jathak Sep 6, 2019
2f40442
Merge pull request dart-lang/source_span#39 from jathak/padding
srawlins Oct 15, 2019
34e1c61
Migrate off deprecated isInstanceOf (dart-lang/source_span#40)
natebosch Nov 7, 2019
73c4d39
Run dartfmt --fix (dart-lang/source_span#42)
natebosch Nov 7, 2019
d65560c
Enable package:pedantic lints (dart-lang/source_span#43)
natebosch Nov 7, 2019
ff83890
Be more efficient with String.fromCharCodes (dart-lang/source_span#44)
kevmoo Nov 7, 2019
ecad5bb
Enable and fix a number of lints (dart-lang/source_span#45)
kevmoo Nov 8, 2019
35ff099
Revert "Be more efficient with String.fromCharCodes (dart-lang/source…
natebosch Nov 14, 2019
be21022
Enforce and fix prefer_single_quotes (dart-lang/source_span#47)
natebosch Nov 14, 2019
b41607b
Fix remaining prefer_single_quotes and fail travis on lints (dart-lan…
natebosch Nov 22, 2019
373d878
Enable comment_references lint (dart-lang/source_span#50)
natebosch Dec 5, 2019
1aaeb5a
Fix newly enforced package:pedantic lints (dart-lang/source_span#51)
natebosch Dec 5, 2019
9ff0d68
Add support for highlighting multiple spans at once (dart-lang/source…
nex3 Jan 15, 2020
4ce9a76
Re-enable lint disabled in the last PR (dart-lang/source_span#53)
natebosch Jan 22, 2020
97668da
Add SourceSpan.subspan() (dart-lang/source_span#54)
nex3 Mar 18, 2020
4ddf2b6
Merge the null_safety branch into master (dart-lang/source_span#56)
jakemac53 Jul 14, 2020
bb71863
update for the 2.10 dev sdk (dart-lang/source_span#57)
jakemac53 Jul 22, 2020
d09f50a
Delete .test_config
kevmoo Jul 28, 2020
688d2a3
Update travis-CI to use dev (dart-lang/source_span#58)
kevmoo Jul 28, 2020
575c1d0
fix formatting
kevmoo Sep 4, 2020
1637967
Work around flow analysis bug (dart-lang/source_span#59)
stereotype441 Sep 14, 2020
d851af1
Prep to release 1.8.0-nullsafety.1
jakemac53 Sep 18, 2020
d0e2596
Revert the revert of the flow analysis workaround (dart-lang/source_…
jakemac53 Sep 21, 2020
b37539b
prep to release to unblock flutter (dart-lang/source_span#62)
jakemac53 Sep 21, 2020
712d706
Remove workaround for SDK bug. (dart-lang/source_span#63)
stereotype441 Sep 29, 2020
648fcb5
allow the 2.12 prerelease sdks (dart-lang/source_span#64)
jakemac53 Oct 23, 2020
5a91412
Bump SDK constraints for pub (dart-lang/source_span#65)
natebosch Nov 3, 2020
778a4bb
Remove dependency on package:charcode (dart-lang/source_span#66)
natebosch Nov 4, 2020
35e8cc0
remove redundant experiment (dart-lang/source_span#68)
pq Nov 11, 2020
78ba828
Migrate to GitHub Actions (dart-lang/source_span#69)
athomas Jan 20, 2021
1ccc5d4
Revert "Remove dependency on package:charcode (dart-lang/source_span#…
natebosch Feb 1, 2021
8a9af6b
Prepare to publish for stable null safety (dart-lang/source_span#71)
natebosch Feb 2, 2021
da6912b
Revert "Revert "Remove dependency on package:charcode (dart-lang/sour…
natebosch Feb 4, 2021
313d859
Fix header for multispan with null secondary urls (dart-lang/source_s…
natebosch Feb 4, 2021
8d79ded
Update LICENSE (dart-lang/source_span#75)
franklinyow Mar 31, 2021
1b5cba3
fix lint (dart-lang/source_span#76)
kevmoo Apr 26, 2021
0569ed0
Fix broken lints, update to pkg:lints, Bump SDK constraint (dart-lang…
kevmoo Oct 4, 2021
c1305da
Don't crash when highlighting multiple spans with null URLs (dart-lan…
nex3 Dec 23, 2021
f9bc890
Add SourceSpanWithContextExtension.subspan (dart-lang/source_span#81)
nex3 Apr 5, 2022
4db8950
populate the pubspec repository field (dart-lang/source_span#82)
devoncarew May 3, 2022
3c857ab
Properly indent multi-line labels for mutli-span highlights (dart-lan…
nex3 Jul 20, 2022
013c00f
Require Dart 2.18, update lints, latest pkg:lints, add dependabot (da…
kevmoo Oct 25, 2022
ded49cf
Bump actions/checkout from 3.1.0 to 3.2.0 (dart-lang/source_span#89)
dependabot[bot] Jan 3, 2023
b327813
Bump dart-lang/setup-dart from 1.3 to 1.4 (dart-lang/source_span#91)
dependabot[bot] Feb 1, 2023
8a9307e
Bump actions/checkout from 3.2.0 to 3.3.0 (dart-lang/source_span#90)
dependabot[bot] Feb 1, 2023
5499677
add an api usage example (dart-lang/source_span#92)
devoncarew Feb 3, 2023
7a2837b
Bump dart-lang/setup-dart from 1.4.0 to 1.5.0 (dart-lang/source_span#95)
dependabot[bot] Apr 3, 2023
dab9e4e
Bump actions/checkout from 3.3.0 to 3.5.0 (dart-lang/source_span#94)
dependabot[bot] Apr 3, 2023
dd5ecf1
blast_repo fixes (dart-lang/source_span#96)
devoncarew Apr 5, 2023
0c19dae
Add public access to a SourceFile's code units (dart-lang/source_span…
nex3 Apr 5, 2023
5eaf67b
Bump actions/checkout from 3.5.0 to 3.5.2 (dart-lang/source_span#97)
dependabot[bot] May 1, 2023
5ea8221
blast_repo fixes (dart-lang/source_span#98)
devoncarew May 23, 2023
79b03a9
Bump actions/checkout from 3.5.2 to 3.5.3 (dart-lang/source_span#99)
dependabot[bot] Jul 1, 2023
b773a93
Bump actions/checkout from 3.5.3 to 3.6.0 (dart-lang/source_span#101)
dependabot[bot] Sep 1, 2023
916d92d
Bump dart-lang/setup-dart from 1.5.0 to 1.5.1 (dart-lang/source_span#…
dependabot[bot] Oct 1, 2023
fb8a832
Bump actions/checkout from 3.6.0 to 4.1.0 (dart-lang/source_span#102)
dependabot[bot] Oct 1, 2023
2f31c0f
Bump dart-lang/setup-dart from 1.5.1 to 1.6.0 (dart-lang/source_span#…
dependabot[bot] Nov 1, 2023
329aec4
Bump actions/checkout from 4.1.0 to 4.1.1 (dart-lang/source_span#105)
dependabot[bot] Nov 1, 2023
c6f2c0e
Move to latest lints, require Dart 3.1 (dart-lang/source_span#106)
kevmoo Nov 29, 2023
035d7ab
Bump dart-lang/setup-dart from 1.6.0 to 1.6.2 (dart-lang/source_span#…
dependabot[bot] Feb 1, 2024
72bd3fb
Bump actions/checkout from 4.1.1 to 4.1.2 (dart-lang/source_span#108)
dependabot[bot] Apr 1, 2024
cc2dd7e
Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/source_span#109)
dependabot[bot] May 1, 2024
04a0a06
Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/source_span#…
dependabot[bot] May 1, 2024
ac3a287
blast_repo fixes (dart-lang/source_span#111)
devoncarew May 13, 2024
2f14bd5
Bump actions/checkout from 4.1.4 to 4.1.5 in the github-actions group…
dependabot[bot] May 13, 2024
e652540
Bump actions/checkout from 4.1.5 to 4.1.6 in the github-actions group…
dependabot[bot] Jun 1, 2024
9a76bf4
bump lints (dart-lang/source_span#114)
kevmoo Jun 24, 2024
23c8192
Bump the github-actions group with 2 updates (dart-lang/source_span#115)
dependabot[bot] Jul 1, 2024
edadad0
Bump actions/checkout from 4.1.7 to 4.2.0 in the github-actions group…
dependabot[bot] Oct 1, 2024
360c944
blast_repo fixes (dart-lang/source_span#118)
kevmoo Oct 28, 2024
12a0c08
Bump actions/checkout from 4.2.0 to 4.2.2 in the github-actions group…
dependabot[bot] Nov 1, 2024
4aec583
Bump dart-lang/setup-dart in the github-actions group (dart-lang/sour…
dependabot[bot] Dec 1, 2024
bf9cc59
Merge package:source_span into the tools monorepo
mosuem Dec 10, 2024
e62561b
Add issue template and other fixes
mosuem Dec 10, 2024
887264f
merge fixes
mosuem Dec 10, 2024
42f81f9
Merge branch 'main' into merge-source_span-package
mosuem Dec 11, 2024
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
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/source_span.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
name: "package:source_span"
about: "Create a bug or file a feature request against package:source_span."
labels: "package:source_span"
---
4 changes: 4 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@
- changed-files:
- any-glob-to-any-file: 'pkgs/source_maps/**'

'package:source_span':
- changed-files:
- any-glob-to-any-file: 'pkgs/source_span/**'

'package:unified_analytics':
- changed-files:
- any-glob-to-any-file: 'pkgs/unified_analytics/**'
75 changes: 75 additions & 0 deletions .github/workflows/source_span.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: package:source_span

on:
# Run on PRs and pushes to the default branch.
push:
branches: [ main ]
paths:
- '.github/workflows/source_span.yml'
- 'pkgs/source_span/**'
pull_request:
branches: [ main ]
paths:
- '.github/workflows/source_span.yml'
- 'pkgs/source_span/**'
schedule:
- cron: "0 0 * * 0"

env:
PUB_ENVIRONMENT: bot.github


defaults:
run:
working-directory: pkgs/source_span/

jobs:
# Check code formatting and static analysis on a single OS (linux)
# against Dart dev.
analyze:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sdk: [dev]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
with:
sdk: ${{ matrix.sdk }}
- id: install
name: Install dependencies
run: dart pub get
- name: Check formatting
run: dart format --output=none --set-exit-if-changed .
if: always() && steps.install.outcome == 'success'
- name: Analyze code
run: dart analyze --fatal-infos
if: always() && steps.install.outcome == 'success'

# Run tests on a matrix consisting of two dimensions:
# 1. OS: ubuntu-latest, (macos-latest, windows-latest)
# 2. release channel: dev
test:
needs: analyze
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Add macos-latest and/or windows-latest if relevant for this package.
os: [ubuntu-latest]
sdk: [3.1.0, dev]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
with:
sdk: ${{ matrix.sdk }}
- id: install
name: Install dependencies
run: dart pub get
- name: Run VM tests
run: dart test --platform vm
if: always() && steps.install.outcome == 'success'
- name: Run Chrome tests
run: dart test --platform chrome
if: always() && steps.install.outcome == 'success'
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ don't naturally belong to other topic monorepos (like
| [pub_semver](pkgs/pub_semver/) | Versions and version constraints implementing pub's versioning policy. This is very similar to vanilla semver, with a few corner cases. | [![package issues](https://img.shields.io/badge/package:pub_semver-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Apub_semver) | [![pub package](https://img.shields.io/pub/v/pub_semver.svg)](https://pub.dev/packages/pub_semver) |
| [source_map_stack_trace](pkgs/source_map_stack_trace/) | A package for applying source maps to stack traces. | [![package issues](https://img.shields.io/badge/package:source_map_stack_trace-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Asource_map_stack_trace) | [![pub package](https://img.shields.io/pub/v/source_map_stack_trace.svg)](https://pub.dev/packages/source_map_stack_trace) |
| [source_maps](pkgs/source_maps/) | A library to programmatically manipulate source map files. | [![package issues](https://img.shields.io/badge/package:source_maps-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Asource_maps) | [![pub package](https://img.shields.io/pub/v/source_maps.svg)](https://pub.dev/packages/source_maps) |
| [source_span](pkgs/source_span/) | Provides a standard representation for source code locations and spans. | [![package issues](https://img.shields.io/badge/package:source_span-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Asource_span) | [![pub package](https://img.shields.io/pub/v/source_span.svg)](https://pub.dev/packages/source_span) |
| [unified_analytics](pkgs/unified_analytics/) | A package for logging analytics for all Dart and Flutter related tooling to Google Analytics. | [![package issues](https://img.shields.io/badge/package:unified_analytics-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Aunified_analytics) | [![pub package](https://img.shields.io/pub/v/unified_analytics.svg)](https://pub.dev/packages/unified_analytics) |

## Publishing automation
Expand Down
16 changes: 16 additions & 0 deletions pkgs/source_span/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Don’t commit the following directories created by pub.
.buildlog
.dart_tool/
.pub/
build/
packages
.packages

# Or the files created by dart2js.
*.dart.js
*.js_
*.js.deps
*.js.map

# Include when developing application packages.
pubspec.lock
240 changes: 240 additions & 0 deletions pkgs/source_span/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@
## 1.10.1

* Require Dart 3.1
* Move to `dart-lang/tools` monorepo.

## 1.10.0

* Add a `SourceFile.codeUnits` property.
* Require Dart 2.18
* Add an API usage example in `example/`.

## 1.9.1

* Properly handle multi-line labels for multi-span highlights.

* Populate the pubspec `repository` field.

## 1.9.0

* Add `SourceSpanWithContextExtension.subspan` that returns a
`SourceSpanWithContext` rather than a plain `SourceSpan`.

## 1.8.2

* Fix a bug where highlighting multiple spans with `null` URLs could cause an
assertion error. Now when multiple spans are passed with `null` URLs, they're
highlighted as though they all come from different source files.

## 1.8.1

* Fix a bug where the URL header for the highlights with multiple files would
get omitted only one span has a non-null URI.

## 1.8.0

* Stable release for null safety.

## 1.7.0

* Add a `SourceSpan.subspan()` extension method which returns a slice of an
existing source span.

## 1.6.0

* Add support for highlighting multiple source spans at once, providing more
context for span-based messages. This is exposed through the new APIs
`SourceSpan.highlightMultiple()` and `SourceSpan.messageMultiple()` (both
extension methods), `MultiSourceSpanException`, and
`MultiSourceSpanFormatException`.

## 1.5.6

* Fix padding around line numbers that are powers of 10 in
`FileSpan.highlight()`.

## 1.5.5

* Fix a bug where `FileSpan.highlight()` would crash for spans that covered a
trailing newline and a single additional empty line.

## 1.5.4

* `FileSpan.highlight()` now properly highlights point spans at the beginning of
lines.

## 1.5.3

* Fix an edge case where `FileSpan.highlight()` would put the highlight
indicator in the wrong position when highlighting a point span after the end
of a file.

## 1.5.2

* `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.

## 1.5.1

* 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.

## 1.5.0

* Improve the output of `SourceSpan.highlight()` and `SourceSpan.message()`:

* They now include line numbers.
* They will now print every line of a multiline span.
* They will now use Unicode box-drawing characters by default (this can be
controlled using [`term_glyph.ascii`][]).

[`term_glyph.ascii`]: https://pub.dartlang.org/documentation/term_glyph/latest/term_glyph/ascii.html

## 1.4.1

* Set max SDK version to `<3.0.0`, and adjust other dependencies.

## 1.4.0

* The `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.

* The `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.

## 1.3.1

* Properly highlight spans for lines that include tabs with
`SourceSpan.highlight()` and `SourceSpan.message()`.

## 1.3.0

* Add `SourceSpan.highlight()`, which returns just the highlighted text that
would be included in `SourceSpan.message()`.

## 1.2.4

* Fix a new strong mode error.

## 1.2.3

* Fix a bug where a point span at the end of a file without a trailing newline
would be printed incorrectly.

## 1.2.2

* Allow `SourceSpanException.message`, `SourceSpanFormatException.source`, and
`SourceSpanWithContext.context` to be overridden in strong mode.

## 1.2.1

* Fix the declared type of `FileSpan.start` and `FileSpan.end`. In 1.2.0 these
were mistakenly changed from `FileLocation` to `SourceLocation`.

## 1.2.0

* **Deprecated:** Extending `SourceLocation` directly is deprecated. Instead,
extend the new `SourceLocationBase` class or mix in the new
`SourceLocationMixin` mixin.

* Dramatically improve the performance of `FileLocation`.

## 1.1.6

* Optimize `getLine()` in `SourceFile` when repeatedly called.

## 1.1.5

* Fixed another case in which `FileSpan.union` could throw an exception for
external implementations of `FileSpan`.

## 1.1.4

* Eliminated dart2js warning about overriding `==`, but not `hashCode`.

## 1.1.3

* `FileSpan.compareTo`, `FileSpan.==`, `FileSpan.union`, and `FileSpan.expand`
no longer throw exceptions for external implementations of `FileSpan`.

* `FileSpan.hashCode` now fully agrees with `FileSpan.==`.

## 1.1.2

* Fixed validation in `SourceSpanWithContext` to allow multiple occurrences of
`text` within `context`.

## 1.1.1

* Fixed `FileSpan`'s context to include the full span text, not just the first
line of it.

## 1.1.0

* Added `SourceSpanWithContext`: a span that also includes the full line of text
that contains the span.

## 1.0.3

* Cleanup equality operator to accept any Object rather than just a
`SourceLocation`.

## 1.0.2

* Avoid unintentionally allocating extra objects for internal `FileSpan`
operations.

* Ensure that `SourceSpan.operator==` works on arbitrary `Object`s.

## 1.0.1

* Use a more compact internal representation for `FileSpan`.

## 1.0.0

This package was extracted from the
[`source_maps`](https://pub.dev/packages/source_maps) package, but the
API has many differences. Among them:

* `Span` has been renamed to `SourceSpan` and `Location` has been renamed to
`SourceLocation` to clarify their purpose and maintain consistency with the
package name. Likewise, `SpanException` is now `SourceSpanException` and
`SpanFormatException` is not `SourceSpanFormatException`.

* `FixedSpan` and `FixedLocation` have been rolled into the `Span` and
`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.

* `SourceSpan.sourceUrl`, `SourceLocation.sourceUrl`, and `SourceFile.url` now
return `Uri` objects rather than `String`s. The constructors allow either
`String`s or `Uri`s.

* `Span.getLocationMessage` and `SourceFile.getLocationMessage` are now
`SourceSpan.message` and `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.
27 changes: 27 additions & 0 deletions pkgs/source_span/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Copyright 2014, the Dart project authors.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google LLC nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Loading
Loading