You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here the author of #56. You solved the requested feature pretty fast and nicely by adding the register_method. And I wonder if this feature could be extended. But it doesn't seem too obvious how to extend, so I would like to discuss the solution approach first before thinking about writing a PR.
So I have more LSP server specific commands which are somewhat location related (or could be interpreted like this). So for example the rust-analyzer allows to show a list of tests that are using/related to the piece of code under the cursor. It additionally provides information how to run each individual test etc. pp. Which means it is unfortunately not a simple response with Location[]. Though the request parameter are still just TextDocumentPositionParams.
In this exact case, the response structure of the rust-analyzer looks something like this:
So if you take this response and map each entry it to the nested location attribute of it, this would be a regular LSP Location[] data structure again.
Taking this example, I thought about a generic solution approach that puts as less burden as possible on the plugin. And my proposal would be to extend your method representation by adding an optional property called response_preprocessor_callback or something similar (just trying to be expressive). The idea would then be that after the server has responded, the respective logic checks if such a callback is defined and if so, calls it and takes the output of that function to continue processing as always. That would mean for any existing method and all already in use custom ones, nothing changes at all. So it is fully backwards compatible. It also should require not many locations of code to touch and remain hopefully a quite minimal addition.
So an example configuration of a user like me would look the following:
Hey 馃憢
Here the author of #56. You solved the requested feature pretty fast and nicely by adding the
register_method
. And I wonder if this feature could be extended. But it doesn't seem too obvious how to extend, so I would like to discuss the solution approach first before thinking about writing a PR.So I have more LSP server specific commands which are somewhat location related (or could be interpreted like this). So for example the
rust-analyzer
allows to show a list of tests that are using/related to the piece of code under the cursor. It additionally provides information how to run each individual test etc. pp. Which means it is unfortunately not a simple response withLocation[]
. Though the request parameter are still justTextDocumentPositionParams
.In this exact case, the response structure of the
rust-analyzer
looks something like this:So if you take this response and map each entry it to the nested
location
attribute of it, this would be a regular LSPLocation[]
data structure again.Taking this example, I thought about a generic solution approach that puts as less burden as possible on the plugin. And my proposal would be to extend your
method
representation by adding an optional property calledresponse_preprocessor_callback
or something similar (just trying to be expressive). The idea would then be that after the server has responded, the respective logic checks if such a callback is defined and if so, calls it and takes the output of that function to continue processing as always. That would mean for any existing method and all already in use custom ones, nothing changes at all. So it is fully backwards compatible. It also should require not many locations of code to touch and remain hopefully a quite minimal addition.So an example configuration of a user like me would look the following:
What do you think?
The text was updated successfully, but these errors were encountered: