You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sbt server runs collectAnalyses during the initialize handshake, triggering compilation in all projects + platforms locking my sbt shell for a few minutes.
expectation
I expect sbt server not to trigger collectAnalyses during the initialize handshake. A client can trigger collectAnalyses via sbt/exec after initialize, if the client is interested in that action.
Judging from the discussions in #4110, it seems the motivation for running collectAnalyses is to support textDocument/definition. However, only a few sbt server clients use that functionality. Additionally, since collectAnalyses may take a long time in large projects (in scalameta/scalameta I suspect it'll be >10 minutes since we cross-build ~17 modules), the client may want to refine the scope with something like core/collectAnalyses in order to provide a snappier UX.
notes
There is no workaround for clients, this step is hardcoded in sbt server
We want to use sbt server to perform automatic installation in metals (https://github.com/scalameta/metals), but this sbt server behavior is extra unfortunate in our case since the metals client runs a semanticdbEnable command right after initialize, which enables a compiler plugin causing the project to re-compile throwing out the zinc cache from collectAnalyses.
sbt version: 1.1.1
The text was updated successfully, but these errors were encountered:
+1 from me. My initial demo usage for sbt server was to make it a lightweight VS Code backend, and at some point it got hardcoded into initialization. But I agree it would be good to get it out of the initial handshake. Maybe fold it into compile?
I don't know the details of what collectAnalyses does. From my perspective, sbt server provides a generic solution for clients to trigger tasks and commands via sbt/exec. I would leave it to clients to decide what to do.
Followup from #4110
steps
Connect to sbt server in a freshly cloned repo like https://github.com/non/spire
problem
sbt server runs
collectAnalyses
during theinitialize
handshake, triggering compilation in all projects + platforms locking my sbt shell for a few minutes.expectation
I expect sbt server not to trigger
collectAnalyses
during theinitialize
handshake. A client can triggercollectAnalyses
viasbt/exec
afterinitialize
, if the client is interested in that action.Judging from the discussions in #4110, it seems the motivation for running
collectAnalyses
is to supporttextDocument/definition
. However, only a few sbt server clients use that functionality. Additionally, sincecollectAnalyses
may take a long time in large projects (in scalameta/scalameta I suspect it'll be >10 minutes since we cross-build ~17 modules), the client may want to refine the scope with something likecore/collectAnalyses
in order to provide a snappier UX.notes
There is no workaround for clients, this step is hardcoded in sbt server
sbt/main/src/main/scala/sbt/internal/server/LanguageServerProtocol.scala
Line 61 in 187c50c
We want to use sbt server to perform automatic installation in metals (https://github.com/scalameta/metals), but this sbt server behavior is extra unfortunate in our case since the metals client runs a
semanticdbEnable
command right afterinitialize
, which enables a compiler plugin causing the project to re-compile throwing out the zinc cache fromcollectAnalyses
.sbt version: 1.1.1
The text was updated successfully, but these errors were encountered: