Fix async implementation not supported#204
Fix async implementation not supported#204eastonsuo wants to merge 1 commit intopython-lsp:developfrom
Conversation
|
Hey @eastonsuo, thanks for your contribution! Could you explain when this is needed? |
|
I want to use asyncio in plugins, such as when do a async http request for another service, or wait for a asyncio.Event and blocked. (Maybe Endpoint should be changed to AsyncEndpoint to chieve that?) @ccordoba12
|
| import socketserver | ||
| import threading | ||
|
|
||
| import asyncio |
There was a problem hiding this comment.
Please move this to be on top of from functools import partial and leave the blank line here.
I see, thanks for the explanation.
I'm not really sure. @andfoy, what do you think? |
@eastonsuo, could you please clarify your asynchronous case of use? We would assume that you would like to get multiple future objects instead of blocking on a call? |
yes, for example, I would like to post a request asynchronously within a call and on the other hand not blocking another call. I think it can be realized by an AsyncEndpoint and start server by asyncio.run() |
|
The idea of async handler is reasonable, but pylsp already start some threads to run hook handlers that may take time (e.g. linters). It may be reasonable to extend this so that all hook handlers have the option to be written as either However, this should not be implemented in the |
|
Agreed. I think the proper solution is to make the server fully async aware. |
No description provided.