Skip to content

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

Merged
trunk-io[bot] merged 1 commit into
dylan/xcresult-declaration-test-locationsfrom
dylan/lsp-find-program-cross-platform
Sep 10, 2026
Merged

refactor(xcresult): find a language server without requiring xcrun#1179
trunk-io[bot] merged 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

@trunk-io

trunk-io Bot commented Sep 9, 2026

Copy link
Copy Markdown

Stacked PR 1181 failed testing in the merge queue. Please investigate the failure and re-submit the stack.

@dfrankland
dfrankland force-pushed the dylan/lsp-find-program-cross-platform branch from 043e002 to aced65e Compare September 9, 2026 20:10
@trunk-io

trunk-io Bot commented Sep 9, 2026

Copy link
Copy Markdown

Stacked PR 1181 failed testing in the merge queue. Please investigate the failure and re-submit the stack.

@dfrankland
dfrankland force-pushed the dylan/lsp-find-program-cross-platform branch from aced65e to 5ba5bbc Compare September 9, 2026 21:15
@dfrankland
dfrankland force-pushed the dylan/lsp-find-program-cross-platform branch from 5ba5bbc to 7bfe37a Compare September 9, 2026 21:46
@trunk-io

trunk-io Bot commented Sep 9, 2026

Copy link
Copy Markdown

Stacked PR 1181 failed testing in the merge queue. Please investigate the failure and re-submit the stack.

@dfrankland
dfrankland force-pushed the dylan/lsp-find-program-cross-platform branch from 7bfe37a to 98ed02a Compare September 10, 2026 04:55
@dfrankland
dfrankland force-pushed the dylan/lsp-find-program-cross-platform branch from 98ed02a to f581e0c Compare September 10, 2026 05:33
@trunk-io

trunk-io Bot commented Sep 10, 2026

Copy link
Copy Markdown

Stacked PR 1181 failed testing in the merge queue. Please investigate the failure and re-submit the stack.

`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>
@dfrankland
dfrankland force-pushed the dylan/lsp-find-program-cross-platform branch from f581e0c to 5f9e0d4 Compare September 10, 2026 06:14
@trunk-io

trunk-io Bot commented Sep 10, 2026

Copy link
Copy Markdown

Stacked PR 1181 failed testing in the merge queue. Please investigate the failure and re-submit the stack.

@trunk-io
trunk-io Bot merged commit 95a33d7 into main Sep 10, 2026
39 of 46 checks passed
@trunk-io

trunk-io Bot commented Sep 10, 2026

Copy link
Copy Markdown

This pull request was merged into main as part of stacked PR 1181.

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.

3 participants