Instead of returning an empty array in prepareTypeHierarchy, sourcekit-lsp should return nil#1178
Merged
ahoppen merged 1 commit intoApr 17, 2024
Conversation
…kit-lsp should return `nil` Eg. when requesting type hierarchy of a class when the project hasn’t been built, sourcekit-lsp returns an empty array. That causes VS Code to fail with very ambiguous error messages - MISSING provider - Cannot read properties of null (reading 'kind') To work around this, instead of returning an empty array, return `nil` instead. rdar://126228814
ahoppen
force-pushed
the
nil-for-empty-prepare-type-hierarchy
branch
from
April 16, 2024 18:26
5b0caf1 to
f482982
Compare
Member
Author
|
@swift-ci Please test |
bnbarham
approved these changes
Apr 16, 2024
| .sorted(by: { $0.name < $1.name }) | ||
|
|
||
| if typeHierarchyItems.isEmpty { | ||
| // When returning an empty array, VS Code fails with the following two errors. Returning `nil` works around those |
Contributor
There was a problem hiding this comment.
I assume this is because it always expects at least the original element itself? Does call hierarchy have the same issue?
Member
Author
There was a problem hiding this comment.
Call hierarchy doesn’t seem to have that issue.
Member
|
You're ahead of me. :). Saw that today too. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Eg. when requesting type hierarchy of a class when the project hasn’t been built, sourcekit-lsp returns an empty array. That causes VS Code to fail with very ambiguous error messages
To work around this, instead of returning an empty array, return
nilinstead.rdar://126228814