Skip to content

Comments

Refactor / clean-up SKOptions handling#20

Merged
rockbruno merged 4 commits intospotify:mainfrom
rockbruno:rochab/skoptions-refactor
Jul 20, 2025
Merged

Refactor / clean-up SKOptions handling#20
rockbruno merged 4 commits intospotify:mainfrom
rockbruno:rochab/skoptions-refactor

Conversation

@rockbruno
Copy link
Member

@rockbruno rockbruno commented Jul 17, 2025

Another shot at cleaning up and improving the performance of some of the logic involving parsing compiler args, as the current logic was marked for refactoring and was doing a little bit of everything, which made it mostly untestable.

  • Also adds some small improvements to the CommandRunnerFake (cwd validation and throw on unmocked commands)
  • Also removes thread safety on BSPMessageHandler, as sourcekit-lsp uses serial queues on their side

@rockbruno rockbruno force-pushed the rochab/skoptions-refactor branch 3 times, most recently from 84b7604 to 838effa Compare July 18, 2025 09:39
@rockbruno rockbruno marked this pull request as ready for review July 18, 2025 09:39
@rockbruno rockbruno requested a review from a team as a code owner July 18, 2025 09:39
@rockbruno rockbruno force-pushed the rochab/skoptions-refactor branch from d2afdbd to 6520b68 Compare July 18, 2025 13:12
@rockbruno rockbruno force-pushed the rochab/skoptions-refactor branch from 6520b68 to e9fe825 Compare July 20, 2025 08:11

// We currently use a single-threaded setup for simplicity,
// but we can eventually reply asynchronously if we find a need for it.
private let lock: OSAllocatedUnfairLock<Void> = .init()
// FIXME: Can't put state into the lock for now because of recursiveness in the registration.
nonisolated(unsafe) private var state: State = State()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Locking should be unnecessary due to thread safety on sourcekit-lsp's side: https://github.com/swiftlang/sourcekit-lsp/blob/d18aba71ce3c539ec1474470228ab7fea9b66105/Sources/LanguageServerProtocolJSONRPC/JSONRPCConnection.swift#L55-L59

Will only be necessary on our end if we start running things asynchronously.

@josh-arnold-1
Copy link
Contributor

I tested this on my end, it seems to work good!

@rockbruno rockbruno merged commit 02d7b50 into spotify:main Jul 20, 2025
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants