Skip to content

[Fix] Cross References Not Working with LSP #55

@arshonsaadati

Description

@arshonsaadati

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions