ChimeHQ / LanguageServerProtocol

Swift library for working with Language Server Protocol (LSP)
BSD 3-Clause "New" or "Revised" License
56 stars 11 forks source link

Calling `diagnostics` from within Xcode command plugin terminates the server #22

Closed steprescott closed 2 days ago

steprescott commented 2 days ago

Thank you for your work over sourcekit-lsp. I did start at writing my own client but then came across this and it really accelerated my development!

I have come into an issue when calling try await server.diagnostics(diagnosticParams) when the executable is ran from an Xcode command plugin.

In the video below you can see that when I run the Xcode command plugin, by right mouse clicking on the App project and selecting my LSP plugin, the lsp executable is triggered but the server is terminated as soon as diagnostics is called. However, the server does respond to the init message from within the plugin so I know it's not due to incorrect configuration of the plugin.

When I look to the termination reason I see it is 2 aka, uncaughtSignal with a status of 5. But that is as far as I have been able to debug so far.

Within the same video you can see when I run the lsp command from Xcode or via terminal it correctly outputs the errors found in the textDocument.

I would appreciate your help and happy to pay for your time too.

I have attached a .zip file that has an example app that is just an unmodified File > New Project that links the local Swift Package of LSP. The LSP package holds the command that when ran calls diagnostics and a plugin that calls the lsp binary.

Happy to answer any questions or do any further tasks that might support the investigation.

https://github.com/user-attachments/assets/b8287baf-d957-4e46-9f75-363ac7679d3e

Example.zip

steprescott commented 2 days ago

Moved the issue to the client repo.

https://github.com/ChimeHQ/LanguageClient/issues/20