Commit Graph

115 Commits

Author SHA1 Message Date
Eugene Yokota 3b4547718e Remove deprecated methods 2025-05-11 05:23:41 -04:00
xuwei-k 5d660ab8b5 remove unnecessary `case`
- 3ca3633505/rules/src/main/scala/fix/RemoveParameterUntuplingCase.scala
- https://docs.scala-lang.org/scala3/reference/other-new-features/parameter-untupling.html
- https://docs.scala-lang.org/scala3/reference/other-new-features/parameter-untupling-spec.html
2025-02-22 08:48:29 +09:00
Josh Soref 613eb86447
Spelling (#8028)
* spelling: 1.x

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: a

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: aether

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: anymore

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: artifact

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: available

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: be

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: bridge

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: cannot

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: case-insensitive

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: checksum

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: class loads

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: contra

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: dependencies

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: dependency

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: dependent

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: deriveds

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: describes

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: early

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: enclosed

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: evaluation

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: excluding

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: execution

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: for

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: frequently

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: github

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: green

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: https://www

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: https

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: in-sourcing

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: include

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: incompatible

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: indefinitely

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: information

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: inputted

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: just

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: lastmodifiedtimes

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: latest

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: manifest

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: miscellaneous

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: more

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: neither

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: never

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: nonexistent

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: opted

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: outputting

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: params

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: performance

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: preceding

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: presentation

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: project

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: projects

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: protocol

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: related

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: representation

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: res

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: resolverlist

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: resolverset

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: response

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: returned

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: sbt_version

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: scalacheck

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: sentinels

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: separates

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: serves

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: should

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: significant

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: specifically

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: substitute

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: suppress

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: terminal

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: the

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: title

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: transitive

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: version

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: versions

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: want

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: wanting

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: whether

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* link: sbt Cached Resolution

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* link: Testing sbt plugins

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

---------

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2025-02-04 01:11:28 -05:00
xuwei-k da26f3078b use withFilter instead of filter 2025-01-04 09:10:36 +09:00
eugene yokota 52d36653da
Merge pull request #7997 from xuwei-k/scalafmt-convertToNewSyntax
[2.x] update `.scalafmt.conf`. enforce new scala 3 syntax
2025-01-01 22:34:03 -05:00
xuwei-k 13d6626564 update .scalafmt.conf. enforce new scala 3 syntax 2025-01-02 11:25:34 +09:00
xuwei-k a7ba960c17 use enum instead of sealed trait 2025-01-02 10:52:37 +09:00
xuwei-k d7ec1013da remove unused type params 2025-01-01 18:42:59 +09:00
eugene yokota df6e1bc2aa
Merge pull request #7986 from xuwei-k/string-interpolation-format-s
[2.x] use string interpolation instead of `format` method
2025-01-01 03:03:43 -05:00
xuwei-k 13563f9d49 use string interpolation instead of `format` method 2025-01-01 16:02:11 +09:00
xuwei-k a444208b80 remove unnecessary asInstanceOf 2025-01-01 13:32:05 +09:00
Eugene Yokota 3d86f30837 Merge branch '1.10.x' into wip/merge-1.10.x 2024-12-16 03:20:10 -05:00
xuwei-k d193c990d1 remove implicit params. change to using 2024-11-18 06:49:22 +09:00
Friendseeker 828dc04808 Migrate all usages of `System.console == null` 2024-10-28 18:25:16 -07:00
Eugene Yokota 56941dac04 refactor: Update Scala 3 syntax 2024-10-27 23:55:30 -04:00
xuwei-k 22f5c798f5 use to{Int, Long, Double}Option methods 2024-10-23 12:22:40 +09:00
xuwei-k ec70bae39a use extension instead of implicit class 2024-10-23 07:05:38 +09:00
Friendseeker cdab4c10be Scalafmt 2024-10-21 21:38:59 -07:00
Friendseeker b1c4c09a7f Fix bunch more compiler errors 2024-10-21 21:38:59 -07:00
Friendseeker f87ffc8042 Fix CI compile errors 2024-10-21 21:38:59 -07:00
xuwei-k cfb9ffea95 remove deprecated `[this]` qualifier
https://docs.scala-lang.org/scala3/reference/dropped-features/this-qualifier.html
2024-10-03 21:16:48 +09:00
Eugene Yokota c81d269ed2 Merge branch '1.10.x' into wip/merge-1.10.x 2024-05-07 04:39:25 -04:00
Adrien Piquerez 12e9267e1e Remove more unused 2024-03-05 15:25:25 +01:00
Adrien Piquerez c15a4031a9 Fix or mute warnings 2024-03-05 10:39:00 +01:00
Adrien Piquerez e18ddb1666 Fix resolution of * on String 2024-02-07 11:47:22 +01: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
Julien Richard-Foy 72bfb3f45a Transfer copyright to Scala Center 2023-06-20 16:39:07 +02: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 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
Amina Adewusi ca8fd354bd Fixes parsing command args quote problem
Fixes #6802.
2022-02-04 17:52:39 +00:00
tpetillot 4f9fe2af64 fix: propagate `InterruptedException` from JLine.readLine
Motivation:
Cannot exit from InteractionService.readLine

Modification:
Remove try/catch of InterruptedException mapped to None in JLine.readLine
2022-01-31 21:40:32 -05:00
eugene yokota b3aae681bf
Merge pull request #6711 from xuwei-k/fix-scala-2-13-warn
fix Scala 2.13 warnings
2021-11-14 21:53:57 -05:00
xuwei-k 535b15b83e fix Scala 2.13 warnings 2021-11-14 22:59:34 +09:00
xuwei-k aa8b1141f8 Update scalatest 2021-11-14 22:03:59 +09:00
Eugene Yokota 58dfca6e27 Avoid the whitespace after completion 2021-01-15 16:43:19 -05:00
Eugene Yokota 76c4ae56f0 Revert "Set complete flag in completions"
This reverts commit edf43a473b.
This fixes performance regression of tab completion observerd in https://github.com/sbt/sbt/issues/6204
2020-12-19 00:01:16 -05:00
Ethan Atkins 90ca463c70 Add signal registration in LineReader
It is possible for the signal handler to get in a state where it has no
effect in the shell. When this happens, entering ctrl+c does not exit
the shell. To ensure that ctrl+c always exits the shell, we can register
a signal handler in the line reader that write -1 to the terminal input
stream, which should cause the line reader to return an exit command.
2020-11-25 14:31:29 -08:00
xuwei-k 244784c78e load .inputrc file
I think jline2 automatically load ".inputrc" file. But jline3 changed behavior.
2020-10-14 17:13:53 +09:00
Ethan Atkins 2ccc0714e8 Make ConsoleReader creation lazy
I noticed while debugging a jline 2 issue that the SimpleReader was
creating a ConsoleReader on startup even if it was never used.
2020-09-29 10:22:28 -07:00
Ethan Atkins bb8b9a1c99 Fix switching between raw and canonical input
There were a number of issues with swithcing between raw and canonical
issues that affected both the server and the thin client. These were
reported in #5863 and #5856. In both cases, there were issues with
reading input or having the input be displayed. Debugging those issues
revealed a number of issues with how we were using the jline 3 system
terminal and the hybrid interaction with the jline 2 terminal. This
commit eliminates all of our internal jline 2 usage. The only remaining
jline 2 usage is that we create and override the global terminal for the
scala console for scala versions < 2.13. By moving away from jline 2, I
was also able to fix #5828, which reported that the home, end and delete
keys were not working.

One of the big issues that this commit addresses is that the
NetworkClient was always performing blocking reads on System.in. This
was problematic because it turns out that you can't switch between raw
and canonical modes when there is a read present. To fix this, the
server now sends a message to the client when it wants to read bytes and
only then does the client create a background thread to read a single
byte.

I also figured out how to set the terminal type properly for the thin
client on windows where we had been manually setting the capabilities to
ansi, which only worked for some keys. This fix required switching to
the WindowsInputStream that I introduced in a prior commit. Before we
were using the jline 2 wrapped input stream which was converting some
system events, like home and end, to the wrong escape sequence mappings.

The remainder of the commit is mostly just converting from jline 2 apis
to jline 3 apis.

I verified that tab completions, the scala console, the ammonite console
and a run task that read from System.in all work with both the server
and the thin client on mac, linux and windows after these changes.

Fixes #5828, #5863, #5856
2020-09-21 13:42:03 -07:00
Ethan Atkins 52743051eb Remove Terminal.withCanonicalIn
This was implemented as a no-op so we may as well get rid of it.
2020-09-21 13:42:03 -07:00
Eugene Yokota 8521be5ac8 Revert "Filter single semicolons from tab completions"
This reverts commit dcb8e18f0e.
2020-08-13 01:41:19 -04:00
Ethan Atkins adc8d5ee6e Add reprompt fast track command
With the latest sbt snapshot, the ui would get stuck if the user entered
an empty command. They would be presented with an empty prompt and could
not input any commands. This was caused by the change in
d569abe70a that reset the prompt after a
line was read. I had tried to optimize line reading by ignoring empty
commands in UITask.readline so we wouldn't have to make a new thread.
This optimization wasn't really buying much since it only affects how
quickly the user is reprompted after entering an empty command. Unless a
user is spamming the <enter> key, they shouldn't notice a difference.
2020-08-10 14:39:38 -07:00
Ethan Atkins d569abe70a Consolidate terminal prompt management
It was a bit tricky to reason about the state of the prompt for a
terminal. To help make things more clear, I reworked things so that the
LineReader always sets the prompt to Pending after it reads a command.
In MainLoop, we cache the prompt value and temporarily set it to Running
while the command is running, which is really how it should have always
been.
2020-08-09 17:18:47 -07:00
Ethan Atkins edf43a473b Set complete flag in completions
JLine 3 automatically appends a space character to the completion
candidate unless you tell it not to by setting its 'complete' parameter.
This behavior is generally nice because it will automatically complete
something like 'foo/testO<TAB>' to 'foo/testOnly ' which allows the user
to start typing the testname without having to enter space. It does,
however, break scripted completions because it will complete
'scripted wat<TAB>' to 'scripted watch/ '

This commit updates the custom completer to append a " " to the initial
completions and check if there are any additional completions available.
If so, we set the complete flag to true and jline will append a space to
the input when the user presses <TAB> or <ENTER>. Otherwise the old
jline2 behavior where no spaces are ever appended is preserved.
2020-08-04 10:58:04 -07:00
Ethan Atkins 25e83d8fec Add Terminal.withRawOutput api
In the scala console, it's essential that we not process the bytes that
are written to the terminal by jline.
2020-07-10 13:37:54 -07:00
Ethan Atkins 2ecf5967ee Upgrade LineReader to JLine3
This commit upgrades sbt to using jline3. The advantage to jline3 is
that it has a significantly better tab completion engine that is more
similar to what you get from zsh or fish.

The diff is bigger than I'd hoped because there are a number of
behaviors that are different in jline3 vs jline2 in how the library
consumes input streams and implements various features. I also was
unable to remove jline2 because we need it for older versions of the
scala console to work correctly with the thin client. As a result, the
changes are largely additive.

A good amount of this commit was in adding more protocol so that the
remote client can forward its jline3 terminal information to the server.

There were a number of minor changes that I made that either fixed
outstanding ui bugs from #5620 or regressions due to differences between
jline3 and jline2.

The number one thing that caused problems is that the jline3 LineReader
insists on using a NonBlockingInputStream. The implementation ofo
NonBlockingInputStream seems buggy. Moreover, sbt internally uses a
non blocking input stream for system in so jline is adding non blocking
to an already non blocking stream, which is frustrating.

A long term solution might be to consider insourcing LineReader.java
from jline3 and just adapting it to use an sbt terminal rather than
fighting with the jline3 api. This would also have the advantage of not
conflicting with other versions of jline3. Even if we don't, we may want to
shade jline3 if that is possible.
2020-07-10 13:37:53 -07:00
Ethan Atkins 1b03c9b1a9 Make Terminal a trait to support multiple clients
In order to support a multi-client sbt server ux, we need to factor
`Terminal` out into a class instead of a singleton. Each terminal provides
and outputstream and inputstream. In all of the places where we were
previously relying on the `Terminal` singleton we need to update the
code to use `Terminal.get`, which will redirect io to the terminal whose
command is currently running.

This commit does not implement the server side ui for network clients.
It is just preparatory work for the multi-client ui.

The Terminal implementations have thread safe access to the output
stream. For this reason, I had to remove the sychronization on the
ConsoleOut lockObject. There were code paths that led to deadlock when
synchronizing on the lockObject.
2020-06-24 19:22:57 -07:00