Skip to content

Always try to render some documentation for Swift files #2198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

matthewbastien
Copy link
Member

@matthewbastien matthewbastien commented Jul 10, 2025

The error message No documentation could be rendered for the position in this document can be rather confusing. It was also being displayed in situations where the cursor was placed at the beginning or end of a Swift file.

This PR changes the behaviour of finding the nearest symbol to the cursor in atextDocument/doccDocumentation request for Swift files. If the token at the cursor does not point at a valid documentable symbol we will now walk forwards through the list of tokens to see if any of them are a valid documentable symbol. If this still fails then we walk backwards from the cursor until we find a documentable symbol. The error message has also been changed to No documentable symbols were found in this Swift file in the event that no symbols are available at all for display.

Also, I've added a separate error message for unsupported languages with textDocument/doccDocumentation.

@matthewbastien
Copy link
Member Author

@swift-ci please test

@matthewbastien
Copy link
Member Author

@swift-ci please test

@matthewbastien
Copy link
Member Author

@swift-ci please test Windows

@matthewbastien
Copy link
Member Author

@swift-ci please test

@matthewbastien
Copy link
Member Author

@swift-ci please test windows

1 similar comment
@matthewbastien
Copy link
Member Author

@swift-ci please test windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants