opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Swift module resolution fails in opencode edit tool, blocking edits

Open irffanasiff opened this issue 2 weeks ago • 2 comments

Description

Summary
When using OpenCode in a Swift/Xcode workspace with internal Swift packages, the edit tool refuses to apply changes. It runs diagnostics that can't resolve these local modules. The project builds fine in Xcode, but OpenCode's diagnostics fail and block all edits.

Steps to Reproduce

  1. Open an Xcode Swift project with internal Swift packages/frameworks.
  2. Use the edit or write tool on a Swift file that imports these modules.
  3. Observe diagnostics errors like:
    • ERROR [10:8] No such module 'Modulename'
    • ERROR [11:8] No such module 'Modulename'
  4. Edits are rejected even though the project compiles successfully in Xcode.

Expected Behavior

The edit tool should allow changes without requiring module resolution, or it should resolve modules using the project's Xcode build settings.

Actual Behavior

Edits are blocked due to diagnostics in OpenCode’s environment.

Notes

This seems like a false negative because OpenCode doesn’t load Xcode build configurations or package dependencies. This makes it impossible to apply Swift edits in otherwise valid projects.

irffanasiff avatar Jan 13 '26 12:01 irffanasiff

This issue might be a duplicate of existing issues. Please check:

  • #4295: sourcekit-lsp - wrong error that can't find function/module in scope but app working in simulator correct (very similar symptom - cannot find modules that should be available)
  • #4258: Swift LSP not detected (related Swift LSP detection issue)
  • #6310: Sessions become unusable due to large LSP diagnostics (related to edit tool being blocked/unusable due to diagnostics issues)

Feel free to ignore if none of these address your specific case.

github-actions[bot] avatar Jan 13 '26 12:01 github-actions[bot]

This is a blocker for me as the agent is no more able to work on my project

irffanasiff avatar Jan 13 '26 12:01 irffanasiff