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

Infoview stalls with message "Waiting for Lean server to start..." #122

Closed
nateyazdani opened this issue Feb 12, 2022 · 13 comments · Fixed by #127
Closed

Infoview stalls with message "Waiting for Lean server to start..." #122

nateyazdani opened this issue Feb 12, 2022 · 13 comments · Fixed by #127
Assignees

Comments

@nateyazdani
Copy link

nateyazdani commented Feb 12, 2022

Hello!

I've been following the Lean 4 development on my arm64 macOS system for some time now without much trouble by locally compiling both elan and lean4, and until just recently, everything has worked swimmingly. Unfortunately, I have hit a wall trying to diagnose what has broken recently, causing the infoview to stall indefinitely with the message "Waiting for Lean server to start...". The VSCode output log reports nothing except my toolchain versions: elan 1.3.2-pre (2ab7218e1 2022-02-04) and Lean (version 4.0.0, commit 0649e5fa8ac7, Release).

Any guidance or advice on how I can debug this problem would be greatly appreciated!

Edit:
I'm attempting to follow the instructions for local development+debugging of vscode-lean4 itself, and I saw a potentially interesting line in the debug console: ### error opening document: TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator)) [vscode-lean4/src/utils/clientProvider.ts:140]. When I comment out the exception handler, the debug console shows the full stack trace attached here: console.log.

@nateyazdani
Copy link
Author

nateyazdani commented Feb 12, 2022

Follow up: I have figured out that the bug I'm experiencing was introduced in vscode-lean4 v0.0.64. I have confirmed that v0.0.60, v0.0.61, v0.0.62, and v0.0.63 all work successfully.

I think that the specific commit at fault here is fa2b871a7ca2a1c6b05655cfe07aed243a8cb1ff . Perhaps the ClientProvider class is somehow surprised by the set of toolchains reported by elan? On my system, elan show outputs the following:

installed toolchains
--------------------

lean (default)
lean-bootstrap

active toolchain
----------------

lean (default)
Lean (version 4.0.0, commit 0649e5fa8ac7, Release)

where "lean" is linked to the build/release/stage1 directory under my checkout of lean4 (and similarly "lean-bootstrap" is linked to the build/release/stage0 directory).

@SquidDev
Copy link

I also hit this yesterday, and my understanding of this is that if the extension can't find a workspace root (so a lean-toolchain file), a lot of the code for launching Lean chokes and errors - creating such a file resolves the problem.

I think part of the underlying problem here is that there's a couple of places where the the workspace/folder URI is annotated as non-null, but passed a null/undefined value. Unfortunately TS doesn't detect this unless it's in strict mode - it's possibly worth turning this on across the project, though not quite sure how much work that'd be.

@nateyazdani
Copy link
Author

Aha! Creating a lean-toolchain file indeed enables the latest version of the vscode extension to use my installation.

Weirdly, I have to restart the language server once per open Lean source file in order to get its symbol outline, but that's a comparatively minor, probably unrelated glitch in the extension. Thanks for the tip!

I will leave this issue open for now, in case the maintainers want to investigate this behavior further (with which I am glad to help). If they don't, then I'm content to close the matter with this straightforward workaround.

@gebner
Copy link
Member

gebner commented Feb 14, 2022

Can you try again with 0.0.67?

@gebner
Copy link
Member

gebner commented Feb 14, 2022

I think part of the underlying problem here is that there's a couple of places where the the workspace/folder URI is annotated as non-null, but passed a null/undefined value. Unfortunately TS doesn't detect this unless it's in strict mode - it's possibly worth turning this on across the project, though not quite sure how much work that'd be.

Yes, that's a good idea. I believe we already enable strict mode for most of the extension (such as the infoview); but for some reason not for the main extension.

@lovettchris
Copy link
Contributor

Fixed more related bits with opening adhoc files in #127

@nateyazdani
Copy link
Author

Sorry to not write back sooner -- have been terribly sick the last few days. I just wanted to confirm that v0.0.67 does indeed resolve this problem on my end. Thanks a bunch!

@lovettchris
Copy link
Contributor

Sorry to hear that Nathaniel, I hope you get to feeling better soon. Please try version v.0.0.68.

@nateyazdani
Copy link
Author

Just confirmed that v0.0.68 also maintains the fixed behavior. Thanks again!

@lovettchris
Copy link
Contributor

Great, thanks for confirming. Can you post the output of elan toolchain list from your machine?

@nateyazdani
Copy link
Author

Certainly:

$ elan toolchain list
lean (default)
lean-bootstrap

The lean toolchain is linked to my local stage1 build of lean4, and the lean-bootstrap toolchain is linked to my local stage0 build of lean4.

@lovettchris
Copy link
Contributor

ok, great, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants