Commit Graph

549 Commits

Author SHA1 Message Date
xuwei-k 7279f659e0 Update .scalafmt.conf. re-format 2024-09-07 16:37:49 +09:00
Eugene Yokota c81d269ed2 Merge branch '1.10.x' into wip/merge-1.10.x 2024-05-07 04:39:25 -04:00
Stefan Zeiger da79479ff7 Fix logging of raw strings
sbt passes raw string messages in `ConsoleAppenderFromLog4J` to `StringFormatterMessageFactory`. This is wrong because these strings are pre-formatted and should not be processed again for formatting. There is no way to pass parameters to them anyway. This causes problems when the raw strings contain characters that `StringFormatterMessageFactory` wants to interpret.

For example, when using `-Ystatistics`:

```
ERROR StatusConsoleListener Unable to format msg:   nscprofiling                : 1 spans, ()7.543ms (0.3%)
java.util.UnknownFormatConversionException: Conversion = ')'
at java.base/java.util.Formatter.checkText(Formatter.java:2732)
at java.base/java.util.Formatter.parse(Formatter.java:2718)
at java.base/java.util.Formatter.format(Formatter.java:2655)
at java.base/java.util.Formatter.format(Formatter.java:2609)
at java.base/java.lang.String.format(String.java:2938)
at org.apache.logging.log4j.message.StringFormattedMessage.formatMessage(StringFormattedMessage.java:121)
at org.apache.logging.log4j.message.StringFormattedMessage.getFormattedMessage(StringFormattedMessage.java:89)
at sbt.internal.util.Appender.$anonfun$appendMessage$1(ConsoleAppender.scala:522)
...
```
2024-05-02 18:31:23 +02:00
Adrien Piquerez 12e9267e1e Remove more unused 2024-03-05 15:25:25 +01:00
Adrien Piquerez 369e647008 Fix scala 2 compat with -Xsource:3 and scala-collection-compat 2024-03-05 13:32:15 +01:00
Adrien Piquerez 0458e8063d Adapt -Wunused 2024-03-05 11:23:00 +01:00
Adrien Piquerez c15a4031a9 Fix or mute warnings 2024-03-05 10:39:00 +01:00
Adrien Piquerez 5425e066a0 Fix SbtRefactorings 2024-02-13 14:01:26 +01:00
Adrien Piquerez e18ddb1666 Fix resolution of * on String 2024-02-07 11:47:22 +01:00
Matthias Kurz 2d7f087753
Add missing logger methods that take Java Supplier 2023-12-05 10:15:51 +01:00
Adrien Piquerez ba6daf1521 Fix deadlock in Terminal init 2023-11-22 15:51:28 +01:00
Adrien Piquerez 99385881f0 ignore discarded Unit 2023-11-22 11:51:15 +01:00
Adrien Piquerez 1f33b27b03 Deactivate cross-compilation except for utils
Lower util projects are used by LM and Zinc
2023-11-22 11:51:15 +01:00
Adrien Piquerez 73e3b43683 Introduce util-core to cross-compile util-logging 2023-11-14 11:43:12 +01:00
Heikki Vesalainen c07ee8411e JLine 3.24.1 and JAnsi 2.4.0. 2023-11-01 21:25:24 +02:00
Martin Duhem f03320047e
Keep logger names in hash set
Previously, the list of logger names that have been created in a given
context with Log4J was being kept in a `Vector`. As a result, subsequent
calls to `logger` on a `Log4JLoggerContext` with the same logger name
would introduce duplicates in the list. Note that Log4J's logger
configuration would not allow duplicates, and only one configuration
object for a given logger name will exist. The duplicates in the list of
logger names are therefore unnecessary.

With this patch, the logger names will be kept in a `HashSet`.

Since the logger names are only used to remove the logger configurations
after the logger context is closed, and the logger configurations
contain no duplicates, removing duplicate logger names should not cause
any issue.
2023-09-25 17:40:12 +02:00
xuwei-k 6c032b8283 some trivial refactoring
- remove unused type params
- use `withFilter` if possible
- use `collectFirst` instead of `collect` and `headOption`
- use `length` instead of `size` if `Array` or `String`
- use `foreach` instead of `map`
2023-06-25 08:57:41 +09:00
xuwei-k 2edb4dcbb6 fix typo 2023-06-24 20:05:52 +09:00
Julien Richard-Foy 72bfb3f45a Transfer copyright to Scala Center 2023-06-20 16:39:07 +02:00
​Andrzej Ressel 4cf2b7269d Cache echoEnabled 2023-06-03 22:44:19 +02:00
Eugene Yokota 9d87f3f596 Add concrete impl for Action 2023-05-14 14:06:46 -04:00
Chris Kipp fa8dfd225d fix: get rid of the `FileChanges` abstraction
I don't believe this is actually needed. We can simplify the
`WorkspaceEdit` further and put together the mapping for `changes`
according to the LSP spec later on down the line. This will allow us to
remove the need for the `URI`, which is problematic.

closes #7252
2023-05-14 09:52:16 +02:00
eugene yokota cf6fac7692
Merge pull request #7242 from ckipp01/action
feat: add in `actions()` to `Problem`
2023-05-12 00:03:49 -04:00
Chris Kipp aeb168aa93 feat: add in `actions()` to `Problem`
This adds a new field into `xsbti.Problem` allowing for the compiler to
forward "actions" that can address diagnostics. The idea largely mimics
a very minimal `CodeAction` that can be found in the [LSP
Spec](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#codeAction)
in order to ensure it will work with a variety of difference clients
that use LSP, and those that don't. In the future the `WorkspaceEdit`
that was created here could also be expanded to handle more advanced
changes, aka resource operations, like creating/moving/deleting files.
For now we only focus on a small subset of these features.
2023-05-10 14:14:13 +02:00
Chris Kipp 300b770ea4 fix: deprecate misspelled diagnosticRelatedInforamation and add in a new one
Relates to https://github.com/sbt/sbt/discussions/7063
2023-05-08 13:38:15 +02:00
Eugene Yokota 51591bde5b Make new more interactive
If the terminal supports ANSI control sequence,
this displays the template list in an interactive way.
The focused template is rendered reversed,
and arrow key can be used to move the focus up/down.
2023-05-06 20:07:47 -04:00
Adrien Piquerez da4ce68142 Fix dead lock between LoggerContext and Terminal 2023-03-28 14:08:15 +02:00
Eugene Yokota e5dd518deb Adjust to changes in develop branch 2023-01-16 00:23:05 -05:00
Eugene Yokota ceb1ea8aad bump Zinc, which uses current util 2023-01-15 23:50:29 -05:00
Eugene Yokota 54c12819df Adjust to the code changes 2023-01-15 23:48:13 -05:00
Eugene Yokota 340721c4a1 KeyMacro 2023-01-15 23:43:57 -05:00
Eugene Yokota 0a38e296ad Update Scalafmt 2023-01-15 23:43:19 -05:00
Eugene Yokota 4bbecf4ee9 Port util-logic 2023-01-15 23:40:57 -05:00
Eugene Yokota cd43045444 Port util-complete 2023-01-15 23:40:57 -05:00
Eugene Yokota 50b062b795 Port util-logging 2023-01-15 23:40:57 -05:00
Eugene Yokota c724e83fd1 Port StringTypeTag 2023-01-15 23:40:56 -05:00
Eugene Yokota 00eba85d98 Cats-like typeclasses 2023-01-15 23:40:56 -05:00
Eugene Yokota bb40e1bc87 Merge branch '1.9.x' into wip/merge-1.9.x 2022-12-31 16:28:47 -05:00
Chris Kipp dadfee5846 fix: also include diagnosticCode and related info in InterfaceUtil
Looks like I missed this in https://github.com/sbt/sbt/pull/6874 and I
hit on it in Mill when I couldn't figure out why it was also empty, and
thanks to @adpi realized it was because of the `LoggedReporter` in zinc
not taking it into account. However before I can bump that this needs to
be bumped as well.

refs: https://github.com/lampepfl/dotty/issues/14904
2022-10-02 04:50:44 -04:00
Chris Kipp 77673eef55 fix: also include diagnosticCode and related info in InterfaceUtil
Looks like I missed this in https://github.com/sbt/sbt/pull/6874 and I
hit on it in Mill when I couldn't figure out why it was also empty, and
thanks to @adpi realized it was because of the `LoggedReporter` in zinc
not taking it into account. However before I can bump that this needs to
be bumped as well.

refs: https://github.com/lampepfl/dotty/issues/14904
2022-08-22 08:37:44 +02:00
Eugene Yokota bbc91a4788 Merge branch '1.7.x' into fport/1.7.x 2022-08-10 21:53:50 -04:00
Adrien Piquerez 634e8799e7 Catch ClosedChannelException in background job logger
We want the background job to stay alive even if its terminal
has been closed and we cannot write to it anymore
2022-08-05 14:45:38 +02:00
Adrien Piquerez 592086b889 Don't use ProxyTerminal in background job
If we use the ProxyTerminal in the background jobs, the logs
would be spread across different terminals, switching from active
client to active client. We want the logs to stick
to the client that started the job.
2022-08-04 16:48:13 +02:00
Adrien Piquerez 6bcda6684a Use BackgroundJobService context instead of MainLoop context
A new context is created and closed for each state of the MainLoop.
But the context of the backgroundJob must stay alive.
So we use a context that is owned by the BackgroundJobService.
It creates a new logger for each background job and cleans it when
the job stops.
2022-08-04 16:48:13 +02:00
Eugene Yokota 2462d5fbcf Fix proxyInputStream#available
proxyInputStream does not override available,
which broke sbt-site previewSite.
This fixes that.
2022-07-10 04:35:57 -04:00
eugene yokota 910ab1951f
Merge pull request #6846 from Nirvikalpa108/fix-deadlock
[1.7.x] Attempts to fix sbt#6810 - deadlock issue
2022-06-26 22:50:22 -04:00
Eugene Yokota 060a85f0d5 Merge branch '1.7.x' into wip/merge-1.7.x 2022-06-13 02:27:30 -04:00
Chris Kipp f90b09f1ee feat: update Problem to account for related information and code
This PR makes changes to the existing `xsbti.Problem` to account for an
optional diagnostic code that the compiler can return for a given
diagnostic and also related information.

Given a piece of code like:

```scala
try {}
```

You'll receive the following:

```
-- [E002] Syntax Warning: /Users/ckipp/Documents/scala-workspace/dotty-error-index/examples/002_EmptyCatchAndFinallyBlockID.scala:3:2
3 |  try {}
  |  ^^^^^^
  |  A try without catch or finally is equivalent to putting
  |  its body in a block; no exceptions are handled.
```

The `E002` here is the actual code. Right now there would be no
description.

Some diagnostics have multiple positions that they need to represent.
You can see an example of this
[here](lampepfl/dotty#14002) in Dotty with the
use of inlining. Instead of needing to rely on including all of that
information in the diagnostic message it can now be extracted out into
a `DiagnosticRelatedInformation`.

These changes reference the conversation in #6868
2022-04-12 11:13:19 +02:00
Amina Adewusi 020385d917 Attempts to fix sbt#6810 - deadlock issue 2022-03-18 17:23:30 +00:00
eugene yokota 2338bea9db
Merge pull request #6839 from sbt/1.7.x
Porting 1.7.x to develop
2022-03-18 12:17:26 -04:00