scalameta / metals

Scala language server with rich IDE features 🚀

Home Page:https://scalameta.org/metals/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Autocomplete not working with Scala 2.13, but working with Scala 3

durban opened this issue · comments

Describe the bug

git clone https://github.com/durban/choam.git
cd choam
git checkout 535f05a5
sbt

In the sbt console:

staticAnalysis

Start VSCode with Metals, import project, use sbt as the build server (Ctrl+Shift+P, "switch build server"). Wait until it connects to the already running sbt.

Open the file core/shared/src/main/scala/dev/tauri/choam/core/Txn.scala in VSCode. Go to the end of line 68 with the cursor.

    final def commit(implicit F: AsyncLike[F]): F[A] = {
      val rxn = unwrap(self)
      rxn // <-- HERE

      F.async.never[A]
    }

Hit .; nothing happens.

Expected behavior

I'd expect some method names to appear for autocomplete.

Operating system

Linux

Editor/Extension

VS Code

Version of Metals

1.3.0

Extra context or search terms

Metals Java: 21.0.2 from Eclipse Adoptium located at .../.cache/coursier/arc/https/github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2%252B13/OpenJDK21U-jdk_x64_linux_hotspot_21.0.2_13.tar.gz/jdk-21.0.2+13

Metals Server version: 1.3.0

Below are listed the build targets for this workspace. One build target corresponds to one classpath. For example, normally one sbt project maps to two build targets: main and test.

Project's Java: 21.0.2 located at .../openjdk/jdk-21.0.2+13

Build definition is coming from sbt.

Build server currently being used is sbt v1.9.9. 

Additional information: if val rxn has an explicit type written, like this:

    final def commit(implicit F: AsyncLike[F]): F[A] = {
      val rxn: Rxn[Any, A] = unwrap(self)
      rxn

      F.async.never[A]
    }

then autocomplete works as expected when hitting ..

Also, if I do ++3.3.3 in sbt before starting VSCode, autocomplete works as expected when hitting ..

In the log, I don't see anything strange:

2024.04.26 00:55:47 INFO  Processing buildTarget/compile
2024.04.26 00:55:47 INFO  compiling skiplist
2024.04.26 00:55:47 INFO  time: compiled skiplist in 2ms
2024.04.26 00:55:47 INFO  compiling mcas
2024.04.26 00:55:47 INFO  time: compiled mcas in 4ms
2024.04.26 00:55:47 INFO  compiling core
2024.04.26 00:55:47 INFO  time: compiled core in 5ms
2024.04.26 00:55:47 INFO  Processing buildTarget/scalaTestClasses
2024.04.26 00:55:47 INFO  Processing buildTarget/scalaMainClasses
2024.04.26 00:55:47 INFO  compiling skiplist
2024.04.26 00:55:47 INFO  time: compiled skiplist in 3ms
2024.04.26 00:55:47 INFO  compiling mcas
2024.04.26 00:55:47 INFO  time: compiled mcas in 560μs
2024.04.26 00:55:47 INFO  compiling core
2024.04.26 00:55:47 INFO  time: compiled core in 5ms