File changed on disk with a content-mapped or `.d.ts` extension never triggers workspace/diagnostic/refresh
Mantenedores costumam responder em até 1 dia
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 35/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Estagnada
- Stack de tecnologia
- javascript, node.js, typescript
- Domínio
- backend, devtools, testing-qa
Direção de pesquisa
Start with the change in #64159 and trace Session.DidChangeWatchedFiles, path.Extension(), and the content mapper extension check described in the issue. Use the linked repro repository with npm install && npm run repro to compare changes to dep.ts, shape.data, and an open shape.data file. Done when disk changes to mapped files and .d.ts files trigger diagnostic refreshes.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
🔎 Search Terms
"content mapper", "contentMappers", "workspace/diagnostic/refresh", "didChangeWatchedFiles", "isRelevantExtension", "stale diagnostics", "restart TS server", ".d.ts"
🕗 Version & Regression Information
- This changed in #64159, which switched
Session.DidChangeWatchedFilesfrom taking everything after the last dot topath.Extension(). Seen on [email protected].
⏯ Playground Link
No response
💻 Code
Repro: https://github.com/mrlubos/ts-content-mapper-refresh (npm install && npm run repro)
// tsconfig.json
{ "compilerOptions": { "module": "nodenext", "strict": true, "noEmit": true },
"contentMappers": [{ "package": "toy-mapper", "extensions": [".data"] }] }
// index.ts. toy-mapper turns each `name: type` line of shape.data into a member of `Data`.
import type { Dep } from './dep.js';
import type { Data } from './shape.data';
declare const dep: Dep;
declare const data: Data;
export const fromTs = dep.age; // error until `age` is added to dep.ts
export const fromData = data.age; // error until `age: number` is added to shape.data
🙁 Actual behavior
After shape.data changes on disk (written by another process, with the editor sending workspace/didChangeWatchedFiles), the server never sends workspace/diagnostic/refresh. In VS Code the error on data.age stays until "TypeScript: Restart TS Server". The server already has the right answer: a textDocument/diagnostic request made by hand returns no errors. npm run repro drives tsc --lsp as VS Code does and prints:
- dep.ts changed on disk, refresh requests: 1
- shape.data changed on disk, refresh requests: 0
errors when pulled by hand: [] - shape.data edited while open, refresh requests: 1
🙂 Expected behavior
A change on disk to a file a registered content mapper handles should refresh diagnostics the way a change to a .ts file does, since it changes the program. This matters most when a tool regenerates the mapped file, for example a dev server writing an API description on each reload, because the editor never has that file open.
Additional information about the issue
path.Extension() returns only the extensions TypeScript reads itself. For shape.data it returns "", so the path is treated as a possible directory: DirectoryExists is false and the change is dropped. The check against the extensions a project's contentMappers register is in the else branch, which a mapped extension never reaches.
The same change breaks .d.ts files: path.Extension() returns .d.ts, which isRelevantExtension does not list, so a declaration file changed on disk does not refresh diagnostics either.
A workaround for mapped files is to keep the file open in an editor tab, so VS Code reloads it and sends didChange.
- Linguagem predominante
- Go
- Estrelas
- 112k
- Forks
- 15.4k
- Merge médio
- 3d 6h
- PRs com merge (30d)
- 136
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
-
Native API: formatDiagnosticsWithColorAndContext drops related information without a file locationAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
microsoft/TypeScript#65087 ·
Mantenedores costumam responder em até 1 dia
-
API: `tsc.exe` opens a visible console window on Windows when the parent process has no consoleAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
microsoft/TypeScript#65083 ·
Mantenedores costumam responder em até 1 dia
-
TS7 LSP: documentHighlight returns nothing when the file path contains '@'Talvez livre de novo Um pull request para esta issue foi fechado sem ser mesclado. AbertaBug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
microsoft/TypeScript#64758 ·
Mantenedores costumam responder em até 1 dia
-
Language server (tsc --lsp) exits with code 1 after `shutdown` and `exit`Talvez já em andamento @rajnish-verma-22172 assumiu há 12 dias. AbertaBug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
microsoft/TypeScript#64742 · 1 comentário ·
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á 25 dias. AbertaBug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
microsoft/TypeScript#64661 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de microsoft/TypeScript
Issues semelhantes
-
date_time, url_encode, html_escape, to_unix_time, contains_all and contains_any panic when called without argumentsTalvez já em andamento @antcybersec assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
projectdiscovery/dsl#372 ·
Mantenedores costumam responder em até 1 dia
-
blocked-needs-validation
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
projectcapsule/capsule#2265 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
JuliusBrussee/caveman#1449 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
bot-found bug priority: P3
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
madenvel/KalinkaPlayer#498 ·