Closed driverag22 closed 5 months ago
Hi @driverag22 , indeed this is a known todo, sorry for that. I actually looked into fixing it but it turns out that this particular LSP request is very specific so I'd have to add some custom code for it.
Question, when is the moment you usually call selectionRange
? When the document has ended checking?
Question, when is the moment you usually call
selectionRange
? When the document has ended checking?
Hello @ejgallego, we indeed usually call the request when the document has ended checking.
We have a setting where the user can choose whether to display detailed errors, i.e., the squiggly underline only shows at the characters related to the error, or line-long errors where the underline is extended to the whole line.
Question, when is the moment you usually call
selectionRange
? When the document has ended checking? Hello @ejgallego, we indeed usually call the request when the document has ended checking.
Good, then this call should work fine; as of now, the request will wait on the highest point that was requested to be ready.
Note that I didn't add a test case, maybe that's something good for us to do.
We have a setting where the user can choose whether to display detailed errors, i.e., the squiggly underline only shows at the characters related to the error, or line-long errors where the underline is extended to the whole line.
Actually for this use case, I think you would be much better served by coq-lsp
including that information in the diagnostic itself. So we could add to the extra
field for errors a sentenceRange
parameter that contains precisely this information. Then you could just choose at the time you are displaying the diags without a further callback.
What do you think?
So we could add to the
extra
field for errors asentenceRange
parameter that contains precisely this information. Then you could just choose at the time you are displaying the diags without a further callback.What do you think?
That would be lovely and would indeed probably fit better for our use case and make the editor much more responsive.
Done in #670 , it needs testing tho, but seems to work here.
Thank you, I will let you know how it goes in the coming days.
Describe the bug When using the
textDocument/selectionRange
request, to which I pass aTextDocumentIdentifier
and an array of positions, instead of getting back an array of ranges for each of the positions I get back an array with a single range for one of the positions.To Reproduce The code I used that leads to this error can be found below (in a screenshot as well as simply copied over), together with the output. Steps to reproduce the behavior:
SelectionRangeParams
object with the respectiveTextDocumentIdentifier
and the positions array.Expected behavior After sending the request I expect the returned array of ranges to contain one range per position sent. In other words, the length of the return array should be equal to the length of the position array passed in the request.
Screenshots The output we get and relevant piece of code:
Code:
Desktop (please complete the following information):
Additional context This occurred while working on waterproof-vscode, which is a vscode extension and coq editor that relies on coq-lsp. The error should occur on the normal coq-lsp plugin directly. From a talk with Emilio, the problem seems to be that the code is currently lazy and only checks the first position instead of iterating over the array.