Repository navigation
Go to Definition fails for properties using external package property wrappers #2758
Description
Activity
- moved this to Unscreened in Swift Extension for Visual Studio Code
on Aug 27, 2026 Thank you for the bug report!
It seems like this is a SourceKit-LSP issue rather than a Swift extension issue. I'm going to transfer this over to the SourceKit-LSP repository for the maintainers there to have a look.
Thanks for the report, @rssole. I was, however, unable to reproduce it. Would you be able to gather a diagnose bundle as described in https://github.com/swiftlang/sourcekit-lsp/blob/main/Documentation/Diagnose%20Bundle.md, ideally with extended logging enabled, and, if possible, a project that reproduces the issue. That would be great to determine what’s going wrong here.
Thanks for the report, @rssole. I was, however, unable to reproduce it. Would you be able to gather a diagnose bundle as described in https://github.com/swiftlang/sourcekit-lsp/blob/main/Documentation/Diagnose%20Bundle.md, ideally with extended logging enabled, and, if possible, a project that reproduces the issue. That would be great to determine what’s going wrong here.
Hey, well, thanks for looking into this, actually after lengthy discussion with Codex 😄 I have reached setup (via lsp server arguments) where source kit discovers and indexes everything required so all works like a charm....
Essentially it was my lack of knowledge how sourcekit lsp works under the hood and how to setup and what arguments to give to SKLSP server....
Feel free to close this thing 😄
Out of curiosity: What was the change that fixed it? Knowing it might help others if they are facing a similar problem.
Out of curiosity: What was the change that fixed it? Knowing it might help others if they are facing a similar problem.
Oh well sorry I didn't get there is this question 😄 ...to be honest I didn't dwell into all details what codex suggested but I believe this was key part:
"-Xswiftc", "-I", "-Xswiftc", "/path/to/local/SPM/module/.build/arm64-apple-ios-simulator/debug/Modules",where build output was explicitly given to the lsp server... somehow perhaps due to complexity of my workspace lsp server didnt scan all that scanned should be.... I hope that will help anyone having issues with indexing/navigation.
That should really not be necessary and we should figure out what needs to be done to support this out of the box. If you could attach the diagnose bundle (and possibly a project) as requested in #2758 (comment) that would be great.
Also, could you share which command you use to build the package? Is it a plain
swift buildor do you add more arguments there as well?oh well... it is really complicated stuff the project I am working on.... it is corporate thing and ridiculously complex....so not sure I could share it really....
Yes it builds with swift build and packages resolution is fine.... yet it builds only with constraining it to iOS SDK because package which is part of workspace does not build for MacOS at all because of diverged mac os versions requirements among referenced packages. The thing is that all of that I did to make it work completely in Cursor as it XCode all works like a charm, so I was sure it can also work in Cursor, and after adding those inclusions and putting .build output directory within SPM package/component of workspace... LSP caught up...
Could you share the
swift buildcommand you use to build your package? That should give me some more context of what might be the issue here.Yes of course... I give it
sdkandtripple:swift build --sdk /Applications/Xcode-26.6.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator26.5.sdk --build-tests --triple arm64-apple-ios26.1-simulatorwithout that, package won't compile (it is package and its dependencies fault not LSPs)
Ah, in that case you should be able to get this to work with the following
.sourcekit-lsp/config.jsonfile that matches your build command.{ "swiftPM": { "sdk": "/Applications/Xcode-26.6.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator26.5.sdk" "triple": "arm64-apple-ios26.1-simulator" } }Ah, in that case you should be able to get this to work with the following
.sourcekit-lsp/config.jsonfile that matches your build command.{
"swiftPM": {
"sdk": "/Applications/Xcode-26.6.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator26.5.sdk"
"triple": "arm64-apple-ios26.1-simulator"
}
}Yes, I do have that, but even so, it wasn't indexing all the SPM modules and externally referenced packages and didn't go to definition present there. So ... intra-module it worked,but yet after adding those -i inclusions, it started working cross-module/packages.
Description
Go to Definition fails for properties using a property wrapper from an external Swift package
Editor
VS Code / Cursor using the official Swift extension and SourceKit-LSP
Description
Go to Definitiondoes not work for a property when the property uses a property wrapper whose type comes from an external Swift package/module.Navigation works normally for plain properties.
Navigation also works with SDK-provided property wrappers such as
@Published.However, when a property wrapper comes from an external Swift package:
The project builds successfully and navigation between other types/files/modules works correctly.
Likewise, replacing the external wrapper with an SDK-provided wrapper such as
@Publishedallows navigation to work as expected.Steps to reproduce
Example
Assume
ExternalWrapperis defined in a Swift package dependency:Go to Definition on:
also does not navigate to the wrapper definition.
If the wrapper is removed:
Expected behavior
Expected behavior
Go to Definition on
valueshould navigate to:and Go to Definition on
ExternalWrappershould navigate to its definition/source when the dependency source is available.Actual behavior
Neither the external property wrapper type nor the wrapped property can be navigated to.
Removing the property wrapper makes navigation to the property work immediately.
Additional information
The package and application build successfully.
SourceKit-LSP otherwise has working cross-file and cross-module navigation in the same workspace.
This appears specific to property wrappers imported from external package/module dependencies rather than property wrappers in general.
Extension version
2.16.7
Swift & OS version
Swift version
Apple Swift 6.3.3
Platform
macOS / iOS Simulator
Update and more info
The issue is actually happening (seems so) when a property-wrapper-backed property property type is inferred from the wrapper initializer.
but this works: