-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Have a per-run time budget for import suggestions #9167
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
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
108cbc8
Have a per-run time budget for import suggestions
odersky 4dcb7ce
Split test into three files
odersky 9be3001
Make import suggestions timeout configurable
odersky 17f4213
Refine timeout config
odersky dc96bb6
Fix timeout config
odersky File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
-- Error: tests/neg/missing-implicit-2.scala:4:24 ---------------------------------------------------------------------- | ||
4 |val f = Future[Unit] { } // error | ||
| ^ | ||
| Cannot find an implicit ExecutionContext. You might pass | ||
| an (implicit ec: ExecutionContext) parameter to your method. | ||
| | ||
| The ExecutionContext is used to configure how and on which | ||
| thread pools Futures will run, so the specific ExecutionContext | ||
| that is selected is important. | ||
| | ||
| If your application does not define an ExecutionContext elsewhere, | ||
| consider using Scala's global ExecutionContext by defining | ||
| the following: | ||
| | ||
| implicit val ec: scala.concurrent.ExecutionContext = scala.concurrent.ExecutionContext.global | ||
| | ||
| The following import might fix the problem: | ||
| | ||
| import concurrent.ExecutionContext.Implicits.global | ||
| | ||
-- [E007] Type Mismatch Error: tests/neg/missing-implicit-2.scala:6:25 ------------------------------------------------- | ||
6 |val b: java.lang.Byte = (1: Byte) // error, but no hint | ||
| ^^^^^^^ | ||
| Found: Byte | ||
| Required: Byte² | ||
| | ||
| where: Byte is a class in package scala | ||
| Byte² is a class in package java.lang |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import Predef.{byte2Byte => _, _} | ||
import scala.concurrent.Future | ||
|
||
val f = Future[Unit] { } // error | ||
|
||
val b: java.lang.Byte = (1: Byte) // error, but no hint |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
-- [E007] Type Mismatch Error: tests/neg/missing-implicit-3.scala:6:44 ------------------------------------------------- | ||
6 |val d: scala.concurrent.duration.Duration = (10, DAYS) // error | ||
| ^^^^^^^^^^ | ||
| Found: (Int, java.util.concurrent.TimeUnit) | ||
| Required: concurrent².duration.Duration | ||
| | ||
| where: concurrent is a package in package java.util | ||
| concurrent² is a package in package scala | ||
| | ||
| | ||
| The following import might fix the problem: | ||
| | ||
| import concurrent.duration.pairIntToDuration | ||
| | ||
-- [E008] Not Found Error: tests/neg/missing-implicit-3.scala:8:48 ----------------------------------------------------- | ||
8 |val d2: scala.concurrent.duration.Duration = 10.days // error | ||
| ^^^^^^^ | ||
| value days is not a member of Int, but could be made available as an extension method. | ||
| | ||
| One of the following imports might fix the problem: | ||
| | ||
| import concurrent.duration.DurationInt | ||
| import concurrent.duration.DurationLong | ||
| import concurrent.duration.DurationDouble | ||
| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import Predef.{byte2Byte => _, _} | ||
import math.Numeric | ||
|
||
val DAYS = scala.concurrent.duration.DAYS | ||
|
||
val d: scala.concurrent.duration.Duration = (10, DAYS) // error | ||
|
||
val d2: scala.concurrent.duration.Duration = 10.days // error |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tgodzik You may want to set this timeout to a very low or even zero value when using the compiler from metals.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the hint! I think we can set it to 0 now, since we don't use that information in the IDE currently.