Skip to content

Refactor the LSP socketpair into build-tagged files - #107

Merged
ernestrc merged 2 commits into
unstablebuild:mainfrom
ejb711:split-lsp-socketpair
Sep 20, 2026
Merged

ernestrc merged 2 commits into
unstablebuild:mainfrom
ejb711:split-lsp-socketpair

Conversation

@ejb711

@ejb711 ejb711 commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Part of Windows support (#68, coordinated on #81). Second small slice moving unix-only syscalls
behind build tags; graphics stay with #82.

lspSocketpair calls syscall.Socketpair, which does not exist on Windows, so idelsp fails to
compile there. The unix implementation moves into a !windows file unchanged.

On Windows it returns an explicit "language servers are not supported on Windows yet" error
instead of the package failing to build. The transport also depends on net.FileConn and on
handing the server one bidirectional handle as its stdin and stdout, neither of which carries over
to Windows, so a real Windows transport (loopback pair with piped stdio) is a separate change.

Linux and macOS are unchanged; TestLSPSocketpairIsCloseOnExec still pins the unix
implementation. After this, the package's only remaining Windows compile error is the Setpgid
process-group attribute, which the next slice handles.

lspSocketpair calls syscall.Socketpair, which does not exist on Windows, so idelsp
fails to compile there (unstablebuild#68). Move it into a !windows file unchanged.

On Windows it returns an explicit "not supported yet" error instead: the transport also
depends on net.FileConn and on passing one bidirectional handle as the server's stdin
and stdout, neither of which carries over, so a real Windows transport is a separate
change. Starting a language server then fails with that error rather than the package
failing to build. Linux and macOS are unchanged; TestLSPSocketpairIsCloseOnExec still
covers the unix implementation.

Signed-off-by: Eric Brooks <[email protected]>
@codecov

codecov Bot commented Sep 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/ide/idelsp/socketpair_unix.go 77.77% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@ernestrc
ernestrc merged commit 583d32d into unstablebuild:main Sep 20, 2026
8 of 9 checks passed
ernestrc added a commit that referenced this pull request Sep 30, 2026
Part of Windows support (#68, coordinated on #81). Third slice; graphics
stay with #82.

Four call sites built `syscall.SysProcAttr` literals with `Setpgid`,
`Setsid` and `Setctty`, and the file scheme killed process groups with 
`syscall.Kill`. None of these exist on Windows, so `workspace`, 
`workspacerpc`, `extensionv2`, `idedebug` and `vte` fail to compile there.

This collects them in a small `internal/procattr` package: 
`NewGroup`, `NewSession`, `LeadsGroup`, `KillGroup` and `Signal`.
The unix implementations are the old code moved unchanged, including
`killProcessGroup` from the file scheme. On Windows a new group is
`CREATE_NEW_PROCESS_GROUP`, a group is killed with 
`taskkill /T /F` (which walks the process tree, with "not found" 
mapped to `os.ErrProcessDone` like `ESRCH` on unix), sessions
and controlling terminals do not exist, and `Signal` supports `SIGKILL` only.

Linux and macOS are unchanged: the existing process-group tests in
`file_scheme_test` and
`workspace_runner_test` pass as before, and new tests pin that the
helpers build exactly the
attributes the literals built. The Windows-tagged tests cover the
`taskkill` arguments and the
group check; `GOOS=windows go vet ./internal/procattr/` passes.

`idelsp`'s single `Setpgid` literal is deliberately left alone here
because #107 touches the same file's imports; it becomes a one-line
follow-up once both land.

Signed-off-by: Eric Brooks <[email protected]>
Signed-off-by: ernestrc <[email protected]>
Co-authored-by: ernestrc <[email protected]>
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