Add generated Requests/Responses/Notifications to protocol#2781
Conversation
|
So in a plugin would you now do def on_server_response_async(self, response: ServerResponse) -> None:
if response.method == "textDocument/hover":
hover = response.result # automatically inferred as Hover | NoneIs that correct? How are the params for custom requests/notifications handled? I guess they are Edit: Actually I guess that's not too important, because for custom requests/notifications, the handler functions and params (if sent from client to server) need to be defined manually in the plugin anyways. So I guess there is no point in using the |
|
Yes, as you said. EDIT: One correction - the |
|
Okay, I have one suggestion: |
That's a bit debatable. The spec schema has definitions for all the requests, responses and notifications. The types here are not 1:1 reflection of those, but shaped and filtered a bit but still very close to protocol. I'm not against the idea of separating it but implementation-wise it would be messy because then we'd need to import hundreds of types from |
|
If you put it into Line 3 in ad090d1 I think that is the best place where these types should belong to. Things like Lines 21 to 41 in ad090d1 are also very related to the protocol, but still not in the official types. The main point of #2660 was to separate official protocol types from our own helpers and type definitions, and I would prefer to keep it that way (otherwise we could just revert #2660 and put everything back into the |
Did not remember that. Then it won't be fault using it :) It will make it harder to make all of those "public" then since I don't want to re-import all of those through EDIT: Actually, shouldn't be needed to re-export all. People will only need the actual request/result params from protocol. |
New types to be used in the new LspPlugin API. More details in sublimelsp/lsp-python-types#31 (comment)