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

Question: How does the Lean LSP server determine whether a file is open? #4980

Closed
LAWArthur opened this issue Aug 11, 2024 · 1 comment
Closed

Comments

@LAWArthur
Copy link

After initialization I sent the textDocument/didOpen request and got the textDocument/publishDiagnostics feedback, so I believe the file's worker has been launched properly. However when I then send a $/lean/rpc/connect request with the exactly same uri, the server replies with ContentModified: Cannot process request to closed file. I've tried delaying or repeating the request but its all the same.

After searching in the source code, I think this error is thrown by lean4/src/Lean/Server
/Watchdog.lean: forwardRequestToWorker
, which uses findFileWorker to check whether file is open. But in handleDidOpen above, startFileWorker is already invoked, so the error makes me confused.

My present guess is that the didOpen request in lean has different specification from the standard LSP(which I follows), like how to convert TextDocument to FileSource I see in the code. But I can't figure it out in the source code or in the vscode Lean4 extension implementation. Do you have any suggestion on how to set up the communication properly?

@LAWArthur
Copy link
Author

I've fixed it. It seems that lean server automatically converts windows path uri to lowercase yet doesn't do the same to uris of incoming requests. Thanks to your awesome project anyway.

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

No branches or pull requests

1 participant