LSP: Fix LSP::LocationLink
's not being returned within an array
#629
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes the issue discussed in a previous PR.
Previously it was possible for the Mint's LS to return a single instance of
LSP::LocationLink
whereas the specification only allows these to be returned within an array (the result must be one ofLocation | Location[] | LocationLink[] | null
)VSCode and similar clients don't seem to mind this, but it would be nice to be within spec! 😅
I have also refactored the definition methods slightly so they are only dealing with
LSP::LocationLink
's. If these are not supported by the client, mapping toLSP::Location
's is done in the main definition method.This allowed me to remove
server : Server
as one of the parameters that had to be passed to each of these methods.I haven't simplified the type signature of the main method as also mentioned in the previous PR. However it does now at least match the specification.