Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Cross References Not Working with LSP #55

Closed
arshonsaadati opened this issue May 9, 2024 · 2 comments
Closed

[Fix] Cross References Not Working with LSP #55

arshonsaadati opened this issue May 9, 2024 · 2 comments

Comments

@arshonsaadati
Copy link

Firstly, thank you so much for building this tool. It is a great pleasure to be able to use my NeoVim environment to code swift!✨

I had a lot of trouble getting the BSP to work with sourcekit lsp, and couldn't find any resources online so documenting my issues and fix in case anyone stumbles on this.

I was unable to get cross-file references to work. The sourcekit lsp was unable to find project references in scope. The issue arised from xcode-build-server not being able to find the build_root after the config step, and a symptom of this is if your "build_root" property in your buildServer.json looks like "build_root": "/Users/arshonsaadati" rather than "build_root": "/Users/arshonsaadati/Library/Developer/Xcode/DerivedData/Simulator_Controller-adadrfjxhdizubdktugddworgvuj". If this is the case, the server.py of the BSP will hang waiting for stdin.

FIX:
The source of the issue is xcode-select if running xcode-select in your command line gives the error xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance. It can be fixed by running sudo xcode-select -s /Applications/Xcode.app/Contents/Developer.

Assuming Xcode is installed in your applications folder, xcode-select, xcodebuild, and xcode-build-server config should function correctly. I've attached a buildServer.json that works for my project as an example, since as a noob I was confused what to put for the scheme argument.
buildServer.json

Feel free to close this issue, as no action is required! Thank you!

@SolaWing
Copy link
Owner

SolaWing commented May 9, 2024

Thank you for your response. here may need a doctor command to auto check environment and tip user how to fix it.

@SolaWing SolaWing closed this as completed Jun 3, 2024
@selfire1
Copy link
Contributor

That comment really helped me, thank you @arshonsaadati !

If you do have space @SolaWing to add a doctor command that would be helpful in my experience 😌

selfire1 added a commit to selfire1/xcode-build-server that referenced this issue Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants