Skip to content

refactor(xcresult): find a language server without requiring xcrun - #1179

Draft
dfrankland wants to merge 1 commit into
dylan/xcresult-declaration-test-locationsfrom
dylan/lsp-find-program-cross-platform
Draft

refactor(xcresult): find a language server without requiring xcrun#1179
dfrankland wants to merge 1 commit into
dylan/xcresult-declaration-test-locationsfrom
dylan/lsp-find-program-cross-platform

Conversation

@dfrankland

Copy link
Copy Markdown
Member

Stacked on #1178. Review that first; this is one commit on top.

xcrun --find is the only way to locate a tool inside an Xcode toolchain, so it is right on macOS and useless anywhere else — it returned None off macOS by construction. That was fine while the only consumer read .xcresult bundles, which cannot exist without Xcode.

The Swift toolchain on Linux ships sourcekit-lsp on PATH and has no xcrun at all. Discovery now tries xcrun on macOS and falls back to a PATH scan. Nothing else in test_locations.rs or lsp.rs is platform-specific, so this is the only thing standing between the declaration index and a non-Apple host.

The scan also checks the executable bit rather than just for a file of the right name, so a stray non-executable sourcekit-lsp reports "not found" instead of failing later at spawn time with something less obvious.

Both new tests run on any platform, which is the point — they inject PATH rather than mutating it, so they are not racy under parallel test execution.

🤖 Generated with Claude Code

`xcrun --find` is the only way to locate a tool inside an Xcode toolchain, so it
is right on macOS and useless anywhere else — it returned `None` off macOS by
construction. That was fine while the only consumer read `.xcresult` bundles,
which cannot exist without Xcode.

The Swift toolchain on Linux ships `sourcekit-lsp` on `PATH` and has no `xcrun`
at all, so discovery now tries `xcrun` on macOS and falls back to a `PATH` scan.
Nothing else in `test_locations.rs` or `lsp.rs` is platform-specific, which makes
this the only thing standing between the declaration index and a non-Apple host.

The scan also checks the executable bit rather than just for a file of the right
name, so a stray non-executable `sourcekit-lsp` reports "not found" instead of
failing later at spawn time with something less obvious.

Both new tests run on any platform, which is the point.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant