-
Notifications
You must be signed in to change notification settings - Fork 6
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
Language server starts very slowly. #25
Comments
How are you using the flake? It is normal that the LSP needs to compile the entire mathlib for the first time, but subsequent runs of LSP should be very quick. A workaround for this could be to not add lean into your shell environment via |
I use basically the |
I use elan before, but i hoped I could change the workflow to be entirely "nix-based" |
Put |
I would want to have the compiling step when running
Tried that, but this doesn't change anything |
wouldn't it be possible to put the .lake folder in the nix store? this would still not solve the long startup time after the first time. I still don't understand why it takes so long after that. |
and yes I confirmed that I'm using the lean binary from the flake |
I'll ask on Lean zulip to see if we can cache I'll look into why this happens and if it is possible to cache the dependency build files, but please keep in mind what we provide here is just a way to build the Lean executable. Everything after that executable is shipped is outside of our control (e.g. suppressing the |
I don't know if the LSP Lean will let you do that. I asked on the Lean zulip chat. For the replay, are you sure this behaviour doesn't happen with elan lean? |
Can you try #26 and add This would replace the system |
I don't have a system-wide Installation of |
What if you clean the |
If that still doesn't work, I have a solution that can make this true:
but I first have to confirm it with the folks on Lean zulip. |
when I changed to the lean4-nix flake I accidentally did two things:
|
Please don't use any of the release candidates. If you look at the
|
yes, I read that and that is why i tried downgrading the version. I used this in the first place because Mathlib officially recommends to use the rc-versions of lean
then why Is there a Package called |
This didn't help it's still replaying stuff |
Why don't use use the require mathlib from git
"https://github.com/leanprover-community/mathlib4" @ "v4.13.0"
Not in this flake. |
Can you ask on Lean 4 zulip about what could cause lake to replay all dependencies? |
I'm pretty sure lake behaves differently with self-built binaries vs binaries from the cache.
But in nixpkgs.
it tells me to run:
this link currently contains |
That is not very specific. Could you pin down what behaviour is different?
Then its not our problem.
Use the Mathlib tag |
I asked in https://leanprover.zulipchat.com/#narrow/channel/270676-lean4/topic/LSP.20Lake.20replaying.20dependencies/near/482705265. This might be unfixable. i.e. the Replay bit From my limited understanding of Lean, the LSP needs to replay all dependency build files. Vide https://github.com/leanprover/lean4/blob/v4.12.0/src/lake/Lake/Build/Common.lean#L99 /--
Checks whether `info` is up-to-date, and runs `build` to recreate it if not.
If rebuilt, saves the new `depTrace` and build log to `traceFile`.
Returns whether `info` was already up-to-date.
**Up-to-date Checking**
If `traceFile` exists, checks that the hash in `depTrace` matches that
of the `traceFile`. If not, and old mode is enabled (e.g., `--old`), falls back
to the `oldTrace` modification time as the point of comparison.
If up-to-date, replay the build log stored in `traceFile`.
If `traceFile` does not exist, checks that `info` has a newer modification time
then `depTrace` / `oldTrace`. No log will be replayed.
-/
@[specialize] def buildUnlessUpToDate?
[CheckExists ι] [GetMTime ι] (info : ι)
(depTrace : BuildTrace) (traceFile : FilePath) (build : JobM PUnit)
(action : JobAction := .build) (oldTrace := depTrace.mtime)
: JobM Bool := do
|
the Replay doesn't happen with a |
It may be because of this https://github.com/leanprover/lean4/blob/master/src/lake/README.md#augmenting-lakes-search-path |
Could you try adding |
I had
|
Then I don't know how to solve this issue |
I found a possible solution to your problem. If you build mathlib with this flake, and set this variable in your LEAN_PATH = "${mathlib.modRoot}"; This will expose the compiled module root to Lean LSP and it should probably start faster. |
When I started Using this the language server started very slowly (especially when using
Mathlib
in a project.)It started by compiling all of
Mathlib
for ~3h on my (relatively slow) Laptop into the.lake
folder.Since that is finished It takes "only" ~10min to start while the language server logs stuff like:
⚠ [206/1884] Replayed Mathlib.Logic.ExistsUnique
I set my editor plugin to use the lean binary from the devshell in the flake.Shouldn't this one have access to some kind of prebuilt /Intermediate Binaries? I thought this is what the
*.ilean
and *.olean` files where for.The text was updated successfully, but these errors were encountered: