-
Notifications
You must be signed in to change notification settings - Fork 30
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
The request_definition function takes much time to return result #13
Comments
Hi @masterSunflowers , Thanks a lot for reporting this issue. One of the goals for multilspy that I had starting out was for it to be as good a client library as VSCode is (since most language servers are optimized with IDEs in mind). The reason you see a larger response latency in the first request, and lesser in subsequent ones is because Eclipse JDTLS builds the repository before setting completions available. Could you please try and launch the same repository you launched with multilspy in VSCode, and try to benchmark the latencies you see there, both for the first request and subsequent requests? I would be happy to work on fixing any latencies introduced specifically by multilspy. |
Hi @LakshyAAAgrawal, Thank you for taking the time to help me out. I’ve realized that the latency issue is primarily caused by my implementation. Specifically, for each request_definition, I call: with lsp.start_server():
result = lsp.request_definition(params) This means that for every request, there is additional latency due to creating a context with However, when I tested this across various projects, I encountered another problem: in some cases, the with After reviewing the logs, I noticed the following: INFO:multilspy:{"time": "2024-12-13 06:27:20", "level": "INFO", "caller_file": "eclipse_jdtls.py", "caller_name": "window_log_message", "caller_line": 353, "message": "LSP: window/logMessage: {\"type\": 3, \"message\": \"Dec 13, 2024, 6:27:20 AM Finished creating the Java project jdt.ls-java-project\"}"}
INFO:multilspy:{"time": "2024-12-13 06:27:20", "level": "INFO", "caller_file": "eclipse_jdtls.py", "caller_name": "window_log_message", "caller_line": 353, "message": "LSP: window/logMessage: {\"type\": 3, \"message\": \"Dec 13, 2024, 6:27:20 AM Importing Maven project(s)\"}"} Does the language server in your implementation actually install or import all Maven projects during startup? If so, that would explain why it takes so much time to initialize. |
I certainly expect this will take a lot of extra time. Can you try to do the lsp.start_server just once per repository you want to use?
Please have a look at multilspy/src/multilspy/language_servers/eclipse_jdtls/initialize_params.json Lines 519 to 524 in 5ee45db
Can you suggest a better way to handle multi-project Java repos? |
I’m using this library to retrieve definitions of code elements for Java. The request_definition function is one I use frequently. However, I’ve noticed that the first request takes about 10 to 30 seconds to complete, and in some cases, it can take as long as 100 seconds. Subsequent requests are faster, taking around 5 to 10 seconds, but this still feels excessive. I’m not sure if this behavior is normal, but it’s too slow for my needs.
The text was updated successfully, but these errors were encountered: