Language server (tsc --lsp) exits with code 1 after `shutdown` and `exit`
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 76/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- go
- Domínio
- backend-api-design, devtools
Direção de pesquisa
Comece em tsc/internal/lsp/server.go, acompanhando o caminho da issue por handleExit, dispatchLoop e Run; depois, leia tsc/cmd/tsc/lsp.go, onde o erro se transforma no código de saída 1. Reproduza o problema com o repro.py fornecido, tanto com um documento aberto quanto sem nenhum documento aberto. O trabalho estará concluído quando um shutdown normal seguido de exit retornar o código 0, enquanto o comportamento de saída inesperada descrito na issue permanecer intacto.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
🔎 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
- Linguagem predominante
- Go
- Estrelas
- 111k
- Forks
- 16.4k
- Merge médio
- 1d 11h
- PRs com merge (30d)
- 148
Preparar o ambiente
Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de microsoft/TypeScript
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
microsoft/TypeScript#64758 ·
Mantenedores costumam responder em até 1 dia
-
Class names `eval` and `arguments` are not reported as invalid strict mode bindingsTalvez já em andamento @dmety assumiu há 5 dias. AbertaBug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
microsoft/TypeScript#64661 ·
Mantenedores costumam responder em até 1 dia
-
Non-enum CLI options with multiple values separated by comma and space aren't whitespace trimmedTalvez já em andamento @RyanCavanaugh assumiu há 6 dias. AbertaBug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
microsoft/TypeScript#64618 · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
TypeScript 7 VS Code extension: a workspace "typescript" 7.x package is not detected, only "@typescript/native-preview", which is no longer publishedTalvez já em andamento @jakebailey assumiu há 6 dias. AbertaNeeds Investigation
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
microsoft/TypeScript#64565 · 1 reação · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
`EFNoLeadingComments` suppresses synthesized leading comments in tsgo; Strada only suppresses source commentsTalvez já em andamento @weswigham assumiu há 13 dias. AbertaNeeds Investigation
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
microsoft/TypeScript#64453 · 1 comentário · 1 responsável ·
Mantenedores costumam responder em até 1 dia
Todas as issues de microsoft/TypeScript
Issues semelhantes
-
unbounded value for n in `/v1/logs` can panic/OOMTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Abertasmall item
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
canonical/pebble#1127 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
[schema-coverage] elasticstack_elasticsearch_synonym_set (data source)Talvez já em andamento @github-actions assumiu hoje. Abertaacceptance-tests phase-coding schema-coverage testing triaged
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 81/100
elastic/terraform-provider-elasticstack#5211 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 89/100
open-policy-agent/opa#9366 · 1 reação ·
Mantenedores costumam responder em até 1 dia
-
defect
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
nats-io/nats-server#8752 ·
Mantenedores costumam responder em até 1 dia
-
enhancement needs-acceptance wg/router-models-inference-runtime
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
vllm-project/semantic-router#5015 · 1 comentário ·
Mantenedores costumam responder em até 1 dia