Commit Graph

14 Commits

Author SHA1 Message Date
Ethan Atkins cf745255e8 Apply javafmt in sbt project 2020-01-14 14:38:08 -08:00
Ethan Atkins ad59e71b1a Add util headers
None of the util files had headers.
2019-12-08 10:29:22 -08:00
Guillaume Martres 15522a0cbe Add Problem#rendered to customize how problems are shown
Dotty has its own logic for displaying problems with the proper file
path, position, and caret, but if we store this information in
Problem#message we end up with duplicated information in the output
since Zinc will prepend/append similar things (see
sbt.internal.inc.ProblemStringFormats). So far, we worked around this in
Dotty by using an empty position in the sbt bridge reporter, but this
means that crucial semantic information that could be used by a Build
Server Protocol implementation and other tools is lost. This commit
allows us to avoid by adding an optional `rendered` field to `Problem`:
when this field is set, its value controls what the user sees, otherwise
we fallback to the default behavior (the logic to do this will be added to
Zinc after this PR is merged and a new release of sbt-util is made).
2018-08-28 03:58:15 +09:00
Guillaume Martres 5e3a102606 xsbti.Position: Also add {start,end}{Line,Column}
Positions in the Language Server Protocol and Build Server Protocol are
line/column-based instead of offset-based, so this is more convenient.
Computing the line/column from the offset is possible but requires
reading the source file.
2018-08-14 02:04:55 +09:00
Guillaume Martres 78834527df xsbti.Position: add startOffset and endOffset
A position now has a start, an end, and a point (the existing `offset`),
just like it does in the Scala compiler. This information is especially
useful for displaying squiggly lines in an IDE.

This commit and the next one are required for https://github.com/sbt/zinc/pull/571
2018-08-14 02:04:43 +09:00
jvican 18a73db57d
Remove unnecessary F0, F1 and Maybe
`F0`, `F1` and `Maybe` have become useless since Java 8 introduced
`Supplier`, `Function` and `Optional` in the default Java 8 standard
library.

Therefore, they are not necessary anymore. This change is required to
change some Zinc's and sbt APIs. They are not widely used, so the
changes will be small.
2017-07-14 15:56:34 +02:00
Eugene Yokota f76e3aa2bb use java.util.Optional in Position 2017-01-25 20:58:37 -05:00
Dale Wijnand 41c7e9b85d
Improve xsbti.Maybe
* Make Nothing a singleton
* Make Maybe's constructor private
* Optimise equals to use reference equality first
* Optimise Just.equals by having proper, non-anonymous subclasses
* Having non-anonymous subclasses makes them have nicer classnames
* Give Just a value() method
2016-10-31 15:33:39 +00:00
Martin Duhem 4e233d81f9 Make Maybe's toString closer to the actual code 2016-08-21 14:24:34 +02:00
Martin Duhem 432c93b0bb Implement hashCode, equals and toString in Maybe
This brings Maybe's behavior closer to scala's Option.
2016-08-19 15:52:17 +02:00
Eugene Yokota 121972577d Define T2 as an interface. 2015-12-16 15:54:23 -05:00
Eugene Yokota 200b351552 Adds xsbti.T2. 2015-12-16 15:46:40 -05:00
Eugene Yokota 994634fc2c Adds xsbti.F1. 2015-12-16 15:28:00 -05:00
Eugene Yokota 871b4f4eef move modules around. 2015-08-20 00:59:57 -04:00