Skip to content

Add location information to TestItems to enable jump to code #192

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

Closed
adam-fowler opened this issue Mar 14, 2022 · 7 comments · Fixed by #701
Closed

Add location information to TestItems to enable jump to code #192

adam-fowler opened this issue Mar 14, 2022 · 7 comments · Fixed by #701
Labels
enhancement New feature or request SwiftPM Swift Package Manager

Comments

@adam-fowler
Copy link
Contributor

It would be good to jump to the source code for a test when you double click on the test in the test explorer (In a similar manner to Xcode).
This requires we get more information about tests. Currently we are getting test list via swift test --list-tests which only gives you the list of tests and no more information. There is a possibility we could get test information from sourcekit-lsp along with extra information like the file they are in and where in that file they are.

@adam-fowler adam-fowler added the enhancement New feature or request label Mar 14, 2022
@adam-fowler
Copy link
Contributor Author

adam-fowler commented Mar 14, 2022

We have this enabled once a file has been opened, unfortunately cannot get it working for all files at startup.

This adds an additional button for jumping to test source, instead of enabling double clicking. This is the standard in vscode

@adam-fowler adam-fowler changed the title Jump to test source when double clicking on test Add location information to TestItems to enable jump to code Apr 7, 2022
@adam-fowler
Copy link
Contributor Author

adam-fowler commented May 25, 2022

Would be good if SwiftPM was able to provide the location data in swift test --list-tests.

Question on forums: https://forums.swift.org/t/listing-tests-with-extended-information/56567

@adam-fowler adam-fowler added the SwiftPM Swift Package Manager label May 25, 2022
@adam-fowler
Copy link
Contributor Author

Looks like we are going to look at a SourceKit-LSP solution for this.

@Zingam
Copy link

Zingam commented Aug 14, 2022

Shall we wait for swiftlang/swift-package-manager#5601 to be implemented?

@adam-fowler
Copy link
Contributor Author

Actually, this is most likely going to done via a custom LSP request. I just haven't got around to chasing it up.

@adam-fowler
Copy link
Contributor Author

SourceKit-LSP issue added swiftlang/sourcekit-lsp#611

@adam-fowler
Copy link
Contributor Author

SourceKit-LSP request workspace/tests is available in Swift 6
Code using it in VSCode can be found in #701

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request SwiftPM Swift Package Manager
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants