fix: add --stdio flag to Cangjie LSPServer spawn#5
Draft
Copilot wants to merge 5 commits into
Draft
Conversation
…ation The Cangjie LSPServer requires --stdio to communicate via stdin/stdout using JSON-RPC. Without this flag, the server either exits immediately or uses a different communication mode, causing it to not effectively run despite the TUI indicator showing it as active. Co-authored-by: SunriseSummer <257439649+SunriseSummer@users.noreply.github.com>
Co-authored-by: SunriseSummer <257439649+SunriseSummer@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix initialization of Cangjie LSP in opencode
fix: add --stdio flag to Cangjie LSPServer spawn
Mar 11, 2026
LSPServer requires libcangjie-lsp.so from the SDK's tools/lib directory. Without LD_LIBRARY_PATH, the process fails immediately with exit code 127. Changes: - Auto-download Cangjie SDK tar.gz if LSPServer not found (linux-x64) - Set CANGJIE_HOME and LD_LIBRARY_PATH when spawning LSPServer - Derive SDK home from binary path for user-installed SDKs too - Update cjfmt formatter to also resolve from auto-installed SDK Co-authored-by: SunriseSummer <257439649+SunriseSummer@users.noreply.github.com>
…n PATH Users are expected to install Cangjie SDK and source envsetup.sh to set PATH, LD_LIBRARY_PATH, and CANGJIE_HOME before running opencode. The only code change from original is adding --stdio to LSPServer spawn. Co-authored-by: SunriseSummer <257439649+SunriseSummer@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Type of change
What does this PR do?
Cangjie LSPServer was spawned with no arguments (
spawn(bin, [])), so it never entered stdio JSON-RPC mode. The process would start but couldn't communicate with the LSP client, appearing dead in the task manager despite the TUI indicator showing active.Additionally,
LSPServerdynamically linkslibcangjie-lsp.sofrom the SDK'stools/lib/— users mustsource envsetup.shto setLD_LIBRARY_PATHbefore running opencode, otherwise the process exits immediately with code 127.Log message also updated to guide users toward
source envsetup.sh.How did you verify your code works?
Downloaded the actual Cangjie SDK (
cangjie-sdk-linux-x64-1.0.5.tar.gz), configured the environment viasource envsetup.sh, and ranLSPServer --stdiowith a full LSP initialize handshake. Server responded with 17 capabilities ("Cangjie language server v1.0"). Confirmed withoutLD_LIBRARY_PATHthe process fails with exit code 127 (libcangjie-lsp.so: cannot open shared object file).Screenshots / recordings
No UI changes.
Checklist
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.