-
Notifications
You must be signed in to change notification settings - Fork 14
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
Construct arg completion regression in 2.13.16 #891
Comments
but one wants to add debugging output to the compiler, so that's a third repo, and this three-repo style of debugging gets tedious fast so then I thought, perhaps I could replicate the test in the scala/scala repo and debug it there there is indeed infrastructure for writing completion tests there, in however, the styles of completion supported (in I don't see any way of testing the method that is actually being called here, which is the case Ident(name) =>
val allMembers = scopeMembers(pos)
val positionDelta: Int = pos.start - focus1.pos.start
val subName = name.subName(0, positionDelta)
CompletionResult.ScopeMembers(positionDelta, scopeMemberFlatten(allMembers), subName, forImport = false) though this code it does call and now I'm not sure whether to:
|
Even at the v2.13.15 tag, this test:
doesn't make
which makes me wonder how this even works in Metals. In my trawl through Metals<->mtags<->scalameta it appeared to me that Note that the Metals test case doesn't work in the Scala REPL, which could be indirect evidence that Metals is adding its own functionality here. |
Investigating from the Metals side a bit, the 2023 PR where these tests landed in the first place was scalameta/metals#5174 (by @kasiaMarek ) and a look at https://github.com/scalameta/metals/blob/main/mtags/src/main/scala-2/scala/meta/internal/pc/completions/ArgCompletions.scala does indeed show that there is a lot of Metals-specific logic here so I think I should abandon the hypothesis that (and now I wish I'd started at that PR in the first place) an additional bit of archaeology is that the support seems to have first landed in scalameta/metals@0543a45 |
@SethTisue thanks for digging. I added some And compared 2.13.15 vs a current snapshot. The The difference is in With a current snapshot the position is So probably the right fix is this? --- a/mtags/src/main/scala-2/scala/meta/internal/pc/completions/ArgCompletions.scala
+++ b/mtags/src/main/scala-2/scala/meta/internal/pc/completions/ArgCompletions.scala
@@ -23,6 +23,7 @@ trait ArgCompletions { this: MetalsGlobal =>
case Apply(Block(defParams, app: Apply), _)
if defParams.forall(p => p.isInstanceOf[ValDef]) =>
app
+ case New(c) => c
case t => t
}
val methodSym = method.symbol That makes the test pass. |
nice, thanks! for community build purposes, I can apply that patch in a fork wdyt @kasiaMarek @tgodzik ? |
references scala/scala-dev#891
Sorry for the late reaction! I am porting it also here scalameta/metals#7047 |
caught by the Metals test suite at e.g. https://scala-ci.typesafe.com/job/scala-2.13.x-jdk17-integrate-community-build/2396/artifact/logs/metals-build.log
according to
git bisect
with dbuild, the culprit PR is scala/scala#10740I've also reproduced the problem outside of dbuild by locally publishing scalameta 4.12.1:
after which, in the Metals repo, one can
and see the failure
The text was updated successfully, but these errors were encountered: