sourcekit-lsp - wrong error that can't find function/module in scope but app working in symulator correct
Description
I have strange error when sourcekit-lsp is ON, get wrong error that can't find function/module in scope but app working in symulator correct
Error [5:52] Cannot find 'NotificationService' in scope Error [12:13] Cannot find "SpontaneousHomeView' in scope Error [21:13] Cannot find 'FriendDiscoveryView' in scope Error [2:8] No such module 'Supabase'
I use stable release of Xcode 26.1.1 ( 17B100 ) and macOS 26.1 (25B78), opencode 1.0.62
https://github.com/swiftlang/sourcekit-lsp/releases - maybe this problem because sourcekit have last update before xcode/macOS 26 was release
When I add in config to not use LSP works fine
OpenCode version
1.0.62
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
macOS 26.1 (25B78)
Terminal
Warp ( main, try on Ghostty - same issee )
This issue might be a duplicate of existing issues. Please check:
- #4258: Swift LSP not detected - also reports Swift LSP problems on macOS 26.1, though focused on LSP not being detected rather than incorrect errors
Feel free to ignore if none of these address your specific case.
Yeah the lsp install needs to be more aware of ur setup prolly
That's probably just the sourcekit-lsp not natively supporting Xcode build systems, hence not seeing certain dependencies. This has been a topic in the Swift community for quite a while unfortunately (see https://forums.swift.org/t/sourcekitd-no-such-module-error/18321).
I'm using xcode-build-server to add the missing bridge between Xcode's build system and sourcekit-lsp, and did not encounter any issues so far.
Here's a quick rundown of the steps:
- Install xcode-build-server using homebrew:
brew install xcode-build-server - In your project directory, generate the build config file:
xcode-build-server config -project *.xcodeproj -scheme <your scheme>(or*.xcworkspace, depending on your setup). - Restart OpenCode
This should ensure the lsp knows which modules are available in the project.
@andre-schaerpf Hello, thanks for tips to use this xcode build server bright, unfornetly have problem to setup this correct, also when use xcodebuildmcp this mcp use own tools and can also make some config chaos when try use command for xcode server bright - I know my setup can be bad and lame, maybe in future sourcekit will support Xcode build nativly