swiftlang / vscode-swift

Visual Studio Code Extension for Swift
https://marketplace.visualstudio.com/items?itemName=sswg.swift-lang
Apache License 2.0
709 stars 47 forks source link

VSCode cannot read types generated by the OpenAPI Swift plugin (Xcode can). #774

Closed dangdennis closed 2 months ago

dangdennis commented 2 months ago

Describe the bug

If you run one of the examples from swift-openapi-generator, vscode is not able to read the types generated by the plugin. The types are visible in ./build/plugins/outputs/<library-name>. However, the compiler builds just fine.

However, Xcode is able to understand the types used.

To Reproduce Steps to reproduce the behavior:

  1. Clone an example.
  2. Open just the example project folder in vscode.
  3. Build the project with swift build.
  4. Expect to see the types for Client and APIProtocol on mouse hover.

Expected behavior I expect vscode to be able to recognize the generated types.

Environment

dangdennis commented 2 months ago

Would love to help solve this as I've enjoyed the Swift on Server ecosystem and tools so far.

adam-fowler commented 2 months ago

Would love to help solve this as I've enjoyed the Swift on Server ecosystem and tools so far.

Thank you for the offer. This is a known issue with SourceKit-LSP. It is tracked in https://github.com/apple/sourcekit-lsp/issues/665 and https://github.com/apple/swift-package-manager/issues/6700.

I'm going to close this as a duplicate and also because it is not resolvable at the VSCode extension level.