Skip to content

Skip semantic tokens tests if sourcekitd doesn't support the semantic tokens request #947

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

Merged
merged 1 commit into from
Oct 31, 2023

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Oct 27, 2023

When running sourcekit-lsp’s tests using Xcode 15, they fail because the sourcekitd in Xcode 15 does not contain the semantic tokens request. The intended workaround/fix is to dowload a recent Swift development snapshot from swift.org and set it as SOURCEKIT_TOOLCHAIN_PATH when running tests. But that’s not a great experience for new contributors. Instead, if sourcekitd doesn’t support the semantic tokens request, simply skip the test.

This also changes the implementation of the semantic tokens LSP request slightly: When the sourcekitd request to get semantic tokens fails, we now fail the entire LSP request, instead of returning the tokens from the synax tree. I think that’s reasonable because the editor did ask for semantic tokens, not syntactic tokens.

Fixes #940
rdar://117590581

@ahoppen
Copy link
Member Author

ahoppen commented Oct 27, 2023

@swift-ci Please test

@ahoppen
Copy link
Member Author

ahoppen commented Oct 27, 2023

@swift-ci Please test Windows

@bnbarham
Copy link
Contributor

This also changes the implementation of the semantic tokens LSP request slightly: When the sourcekitd request to get semantic tokens fails, we now fail the entire LSP request, instead of returning the tokens from the synax tree. I think that’s reasonable because the editor did ask for semantic tokens, not syntactic tokens.

LSP doesn't have a way to ask for syntactic tokens though, so IMO giving syntactic as a fallback is reasonable enough. Otherwise we should probably keep the old support in (which I'd really prefer not doing but...).

@ahoppen ahoppen force-pushed the ahoppen/skip-semantic-tokens-tests branch from ad2d660 to a4d8217 Compare October 30, 2023 21:09
@ahoppen
Copy link
Member Author

ahoppen commented Oct 30, 2023

@swift-ci Please test

@ahoppen
Copy link
Member Author

ahoppen commented Oct 30, 2023

@swift-ci Please test Windows

… tokens request

When running sourcekit-lsp’s tests using Xcode 15, they fail because the sourcekitd in Xcode 15 does not contain the semantic tokens request. The intended workaround/fix is to dowload a recent Swift development snapshot from swift.org and set it as `SOURCEKIT_TOOLCHAIN_PATH` when running tests. But that’s not a great experience for new contributors. Instead, if sourcekitd doesn’t support the semantic tokens request, simply skip the test.

This also changes the implementation of the semantic tokens LSP request slightly: When the sourcekitd request to get semantic tokens fails, we now fail the entire LSP request, instead of returning the tokens from the synax tree. I think that’s reasonable because the editor did ask for semantic tokens, not syntactic tokens.

Fixes swiftlang#940
rdar://117590581
@ahoppen ahoppen force-pushed the ahoppen/skip-semantic-tokens-tests branch from a4d8217 to ecc550e Compare October 31, 2023 15:27
@ahoppen
Copy link
Member Author

ahoppen commented Oct 31, 2023

@swift-ci Please test

@ahoppen
Copy link
Member Author

ahoppen commented Oct 31, 2023

@swift-ci Please test Windows

@ahoppen
Copy link
Member Author

ahoppen commented Oct 31, 2023

@swift-ci Please test Linux

@ahoppen ahoppen merged commit 9919d03 into swiftlang:main Oct 31, 2023
@ahoppen ahoppen deleted the ahoppen/skip-semantic-tokens-tests branch October 31, 2023 22:09
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.

Fix failed SemanticTokensTests
3 participants