lspSession is a single live LSP server session. cmd.Wait must be called exactly once per *exec.Cmd; both Wait and Close can race to be the caller. A shared sync.Once runs the wait body in one goroutine and exposes the result via the pre-allocated waitDone channel; both Wait and Close block on waitDo
| 213 | // exposes the result via the pre-allocated waitDone channel; both Wait |
| 214 | // and Close block on waitDone to observe the process exit. |
| 215 | type lspSession struct { |
| 216 | h *lspHandler |
| 217 | processCancel context.CancelFunc |
| 218 | stdin io.WriteCloser |
| 219 | cmd *exec.Cmd // captured at construction; never nilled by handler teardown. |
| 220 | |
| 221 | closed atomic.Bool |
| 222 | |
| 223 | waitOnce sync.Once |
| 224 | waitErr error |
| 225 | waitDone chan struct{} // pre-allocated in Connect; closed by the wait goroutine. |
| 226 | } |
| 227 | |
| 228 | // Wait blocks until the LSP process exits. Safe to call concurrently with |
| 229 | // Close. |
nothing calls this directly
no outgoing calls
no test coverage detected