vscode-swift icon indicating copy to clipboard operation
vscode-swift copied to clipboard

Add location information to TestItems to enable jump to code

Open adam-fowler opened this issue 3 years ago • 6 comments

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 avatar Mar 14 '22 14:03 adam-fowler

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 avatar Mar 14 '22 14:03 adam-fowler

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 avatar May 25 '22 20:05 adam-fowler

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

adam-fowler avatar Aug 14 '22 08:08 adam-fowler

Shall we wait for https://github.com/apple/swift-package-manager/issues/5601 to be implemented?

Zingam avatar Aug 14 '22 08:08 Zingam

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 avatar Aug 14 '22 20:08 adam-fowler

SourceKit-LSP issue added https://github.com/apple/sourcekit-lsp/issues/611

adam-fowler avatar Aug 15 '22 15:08 adam-fowler

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

adam-fowler avatar Feb 28 '24 11:02 adam-fowler