Language server (tsc --lsp) exits with code 1 after `shutdown` and `exit`
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 76/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- go
- Área
- backend-api-design, devtools
Línea de trabajo
Empieza en tsc/internal/lsp/server.go y sigue el recorrido del issue por handleExit, dispatchLoop y Run; después, lee tsc/cmd/tsc/lsp.go, donde el error se convierte en el código de salida 1. Reproduce el problema con el repro.py proporcionado, tanto con un documento abierto como sin él. Se considera terminado cuando un shutdown correcto seguido de exit devuelve el código 0 y se mantiene el comportamiento ante una salida inesperada descrito en el issue.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
🔎 Search Terms
tsc --lsp exit code 1, shutdown exit, context canceled, handleExit io.EOF, LSP exit notification
🕗 Version & Regression Information
- I was unable to test this on prior versions because
--lspis new in TypeScript 7: seen withtypescript7.0.2 (tsc --lsp --stdio), macOS arm64. I have not run the nightly; the code path below is unchanged onmainat aa81492.
⏯ Playground Link
No response (language server, not type checking)
💻 Code
Save as repro.py and run python3 repro.py in any directory. It initializes tsc --lsp --stdio, sends shutdown, then exit, and prints the exit code (given a URI, it opens a document first; no argument opens nothing).
# python3 repro.py [URI to open], in a directory with a tsconfig.json
import json, os, subprocess, sys
p = subprocess.Popen(["tsc", "--lsp", "--stdio"], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
def send(msg):
body = json.dumps({"jsonrpc": "2.0", **msg}).encode()
p.stdin.write(b"Content-Length: %d\r\n\r\n%s" % (len(body), body))
p.stdin.flush()
def reply(id):
while True:
length = None
while (line := p.stdout.readline()) not in (b"\r\n", b""):
if line.lower().startswith(b"content-length:"):
length = int(line.split(b":")[1])
if length is None:
return None # the server is gone
msg = json.loads(p.stdout.read(length))
if "method" in msg and "id" in msg: # a request from the server
send({"id": msg["id"], "result": None})
elif msg.get("id") == id:
return msg
root = "file://" + os.getcwd()
send({"id": 1, "method": "initialize", "params": {"processId": os.getpid(), "rootUri": root, "capabilities": {}}})
reply(1)
send({"method": "initialized", "params": {}})
if len(sys.argv) > 1:
doc = {"uri": sys.argv[1], "languageId": "typescript", "version": 0, "text": "const x = 1;\n"}
send({"method": "textDocument/didOpen", "params": {"textDocument": doc}})
send({"id": 2, "method": "shutdown"})
if reply(2) is not None:
send({"method": "exit"})
print("exit code:", p.wait())
🙁 Actual behavior
$ python3 repro.py
context canceled
exit code: 1
The server exits with code 1 after a clean shutdown and exit. Neovim reports any non-zero exit, so every :lsp restart shows "Client tsc quit with exit code 1 and signal 0. Check log for errors".
Reading main at aa81492, the path looks like this:
handleExitreturnsio.EOF.dispatchLoopanswers that withlspExit(nil), which cancels the loop's context.- Its next
s.requestQueue.Get(ctx)then returnscontext.Canceled, and the loop returns that. Runpasses it on, since it isn'tio.EOFand the group's context is done.cmd/tsc/lsp.goprints it and returns 1.
🙂 Expected behavior
Exit code 0: the LSP spec asks for 0 when shutdown came before exit, and 1 otherwise.
Additional information about the issue
No response
- Lenguaje dominante
- Go
- Estrellas
- 111k
- Forks
- 16.4k
- Merge medio
- 1 d 11 h
- PR fusionados (30 d)
- 148
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/TypeScript
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
microsoft/TypeScript#64758 ·
Los mantenedores suelen responder en 1 día
-
Class names `eval` and `arguments` are not reported as invalid strict mode bindingsPosiblemente ocupada @dmety la tomó hace 5 días. AbiertoBug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
microsoft/TypeScript#64661 ·
Los mantenedores suelen responder en 1 día
-
Non-enum CLI options with multiple values separated by comma and space aren't whitespace trimmedPosiblemente ocupada @RyanCavanaugh la tomó hace 6 días. AbiertoBug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
microsoft/TypeScript#64618 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
TypeScript 7 VS Code extension: a workspace "typescript" 7.x package is not detected, only "@typescript/native-preview", which is no longer publishedPosiblemente ocupada @jakebailey la tomó hace 6 días. AbiertoNeeds Investigation
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
microsoft/TypeScript#64565 · 1 reacción · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
`EFNoLeadingComments` suppresses synthesized leading comments in tsgo; Strada only suppresses source commentsPosiblemente ocupada @weswigham la tomó hace 13 días. AbiertoNeeds Investigation
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
microsoft/TypeScript#64453 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de microsoft/TypeScript
Issues similares
-
Add SolentaAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
slavakurilyak/awesome-ai-agents#760 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
agent-review-finding bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
jordansmall/spindrift#5281 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
compiler-explorer/compiler-explorer#9272 ·
Los mantenedores suelen responder en 1 día
-
Integer parameters equal to 2^63 pass the range check in toInt and wrap to a negative numberAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
github/github-mcp-server#3489 ·
Los mantenedores suelen responder en 4 días