-
Notifications
You must be signed in to change notification settings - Fork 340
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
improvement: Use PC for synthetic decorations #5585
Conversation
c701850
to
5b4e3db
Compare
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.
Great work! Sorry that it took mi so long to review
tests/unit/src/test/scala/tests/decorations/SyntheticDecorationsLspSuite.scala
Outdated
Show resolved
Hide resolved
tests/unit/src/test/scala/tests/decorations/SyntheticDecorationsLspSuite.scala
Show resolved
Hide resolved
tests/unit/src/test/scala/tests/decorations/SyntheticDecorationsLspSuite.scala
Show resolved
Hide resolved
tests/unit/src/test/resources/decorations3/example/Miscellaneous.scala
Outdated
Show resolved
Hide resolved
tests/unit/src/test/resources/decorations3/example/GivenAlias.scala
Outdated
Show resolved
Hide resolved
metals/src/main/scala/scala/meta/internal/metals/SyntheticDecorationsProvider.scala
Outdated
Show resolved
Hide resolved
metals/src/main/scala/scala/meta/internal/metals/SyntheticDecorationsProvider.scala
Outdated
Show resolved
Hide resolved
mtags/src/main/scala-2/scala/meta/internal/pc/PcSyntheticDecorationsProvider.scala
Outdated
Show resolved
Hide resolved
tests/cross/src/test/scala/tests/pc/SyntheticDecorationsSuite.scala
Outdated
Show resolved
Hide resolved
tests/cross/src/test/scala/tests/pc/SyntheticDecorationsSuite.scala
Outdated
Show resolved
Hide resolved
31e5af9
to
4929fb0
Compare
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.
Generally, I have only minor comment, otherwise looks good. I'm guessing some unhandled cases will still show up but that's fine. One case is that 1 :: List(1)
turns into 1 :: List[Int](1)[Int]
for Scala 2.
mtags-interfaces/src/main/java/scala/meta/pc/PresentationCompiler.java
Outdated
Show resolved
Hide resolved
mtags-interfaces/src/main/java/scala/meta/pc/SyntheticOptions.java
Outdated
Show resolved
Hide resolved
tests/unit/src/test/scala/tests/decorations/SyntheticDecorationsLspSuite.scala
Outdated
Show resolved
Hide resolved
tests/slow/src/test/scala/tests/feature/SyntheticDecorationsScala3ExpectSuite.scala
Show resolved
Hide resolved
metals/src/main/scala/scala/meta/internal/metals/MetalsLspService.scala
Outdated
Show resolved
Hide resolved
metals/src/main/scala/scala/meta/internal/metals/Compilers.scala
Outdated
Show resolved
Hide resolved
metals/src/main/scala/scala/meta/internal/decorations/SyntheticHoverProvider.scala
Outdated
Show resolved
Hide resolved
mtags/src/main/scala-3/scala/meta/internal/pc/PcSyntheticDecorationProvider.scala
Outdated
Show resolved
Hide resolved
|
||
// TODO: Examinate implicit conversion here and unignore | ||
check( | ||
"wrong-given-conversion".ignore, |
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.
Similar case with case class A(x: Int, g: Int)(implicit y: String)
((y)(y) case class A(x: Int, g: Int)(implicit y: String)
), my bet would be that you have to check if the function for which you add implicit params is not synthetic/has zero extent. Though I guess it make sense to show implicit params for implicit conversation, if both are visible...
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.
my bet would be that you have to check if the function for which you add implicit params is not synthetic/has zero extent
For now I think we can do this and leave show implicit params for implicit conversation
as a follow up
Fixed! |
4218089
to
8ef3139
Compare
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.
Looks good! Just a few last questions and nitpicks
val position = params.getPosition | ||
val line = position.getLine() | ||
val isInlineDecorationProvider = clientConfig.isInlineDecorationProvider() | ||
val newHover = currentDocument(path) match { |
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.
The hover is coming from Semanticdb, but the decoration itself from presentation compiler, will that not be a problem?
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.
Decorations from PC are at least as good as those from semantic db, so there shouldn’t be a case that there is a decoration from semanticdb and not from PC. It's possible that there will no hover on some decorations (ie. given
arguments), because they are not in semanticdb synthetics. We could try to move hover to PC, but since we want to use inlay hints either way I don't think it's worth it?
metals/src/main/scala/scala/meta/internal/metals/Compilers.scala
Outdated
Show resolved
Hide resolved
metals/src/main/scala/scala/meta/internal/metals/MetalsLspService.scala
Outdated
Show resolved
Hide resolved
mtags-shared/src/main/scala/scala/meta/internal/metals/CompilerSyntheticDecorationsParams.scala
Outdated
Show resolved
Hide resolved
mtags/src/main/scala-2/scala/meta/internal/pc/MetalsGlobal.scala
Outdated
Show resolved
Hide resolved
"""|object Main{ | ||
| val head: Double :: tail: List[Double] = List[Double](0.1, 0.2, 0.3) | ||
| val List[Int](l1: Int, l2: Int) = List[Int](12, 13) | ||
| println("Hello!") | ||
| val abc: Int = 123 | ||
| val tupleBound @ (one: String, two: String) = ("1", "2") | ||
| val tupleBound: (String, String) @ (one: String, two: String) = ("1", "2") |
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.
Ideally this should not be added, but we can remove it in a later PR, maybe an issue?
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.
done: #5835
8ef3139
to
3f0e1b9
Compare
Previously, synthetic decarations were provided using semanticdb
3f0e1b9
to
c0bdd96
Compare
c0bdd96
to
2a90dce
Compare
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.
LGTM! O rerun the failed jobs, I don't think the failures are related. Feel free to merge
No description provided.