Skip to content
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

sbt server does collectAnalyses on initialize #4113

Open
olafurpg opened this issue Apr 23, 2018 · 3 comments
Open

sbt server does collectAnalyses on initialize #4113

olafurpg opened this issue Apr 23, 2018 · 3 comments

Comments

@olafurpg
Copy link
Member

olafurpg commented Apr 23, 2018

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 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

appendExec(Exec(s"collectAnalyses", Some(r.id), Some(CommandSource(name))))

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

@eed3si9n
Copy link
Member

+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?

@olafurpg
Copy link
Member Author

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.

@dwijnand
Copy link
Member

Maybe fold it into compile?

Only if it's negligible cost to all other non-LSP, direct and indirect users of compile.

@eed3si9n eed3si9n added the uncategorized Used for Waffle integration label Sep 18, 2018
@eed3si9n eed3si9n added backlog and removed uncategorized Used for Waffle integration x/waffle labels Nov 8, 2018
@eed3si9n eed3si9n removed the backlog label Sep 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants