swiftlang / sourcekit-lsp

Language Server Protocol implementation for Swift and C-based languages
Apache License 2.0
3.31k stars 276 forks source link

Don't work with plugin generated code #1624

Closed yaroslavyaroslav closed 2 months ago

yaroslavyaroslav commented 2 months ago

Swift version

swiftlang-6.0.0.7.6 clang-1600.0.24.1

Platform

macOS 15

Editor

Sublime Text 4

Does the issue reproduce with Swift 6?

Yes

Description

sourcekit-lsp fails to provide code completion for plugin generated code. It fails in either mode regardless of is background indexing enabled or not. Tested on ST4, but as if it's server problem it should reproduce in any editor of choice.

Steps to Reproduce

  1. Install on sublime text LSP and LSP-Sourcekit packages.
  2. clone git@github.com:apple/swift-openapi-generator.git
  3. cd swift-openapi-generator/Examples/hello-world-urlsession-client-example/
  4. subl .
  5. Open the only presented swift file in project Sources/HelloWorldURLSessionClient/HelloWorldURLSessionClient.swift within editor.
  6. if background-indexing is enabled — wait till it finishes. If it's not, build the project.
  7. Restart the sourcekit-lsp server.

Completion and type hinting works for user defined types and types from stdlib, but not for Client object, which is generated by plugin.

Logging

sourcekit-lsp.log

ahoppen commented 2 months ago

Synced to Apple’s issue tracker as rdar://133778179

ahoppen commented 2 months ago

This appears to be the same issue as https://github.com/swiftlang/sourcekit-lsp/issues/665, which also contains a workaround