# (in-progress) XCode LSP with Emacs

* Use xcodebuild to list schemes
* Use xcode-build-server config to configure a buildServer.json
* The lsp-sourcekit package will be able to handle all languages from then on
* REQUIRES a build from XCode (very annoying): Product > Build For > Running
  * Based on the source codes (<https://github.com/SolaWing/xcode-build-server/blob/master/server.py> and <https://github.com/apple/sourcekit-lsp/blob/main/Sources/SKCore/BuildServerBuildSystem.swift#L181>), there are three important things that need to exist:
    * indexDatabasePath: Typically in \`\~/Library/Caches/xcode-build-server/-Users-name-path-to-project/indexDatabasePath-\*\`
    * indexStorePath: Typically in `~/Library/Developer/Xcode/DerivedData/ProjectName-hashlike/Index.noindex/DataStore`
    * compile\_file: Typically called `~/Library/Caches/xcode-build-server/-Users-name-path-to-project/compile_file-ProjectName-md5Hash`
* For god knows what reason, when you do `xcodebuild -workspace ... -scheme ...`, you only get `indexDatabasePath` and `indexStorePath`. compile\_file can only be generated by xcode (the app)
  * There's probably a root cause for this, but I can't be bothered
* So, for a project to be successfully, fully indexed, you need to build at least once in xcode (the app). This is a problem if you're trying to bypass signing with CODE\_SIGN\_IDENTITY="" CODE\_SIGNING\_REQUIRED=NO CODE\_SIGN\_ENTITLEMENTS="" CODE\_SIGNING\_ALLOWED=""

TODO: Put the other commands here


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://chaos.codingindex.xyz/in-progress-xcode-lsp-with-emacs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
