Closed
Description
Bug Report
🔎 Search Terms
- TS Server
- updateopen
- untitled
🕗 Version & Regression Information
Version: 4.2.0-dev.20210201
This also happens in 4.1 so it is not a regression
💻 Repo
- In VS Code
- Create a untitled file: ctrl+n
- Change the language mode of the file to javascript (ctrl+k ctrl+m)
- Now change the mode of the file to TypeScript react
🙁 Bug
This sometimes sees to throw an exception.
Here is the tsserver.log
The relevant section seems is below. My understanding of what is happening:
- VS Code closes
^untitled:Untitled-1
with update open - We then try to open it again with a new call to
updateOpen
- The exception happens
Info 134 [12:03:17.700] request:
{"seq":33,"type":"request","command":"updateOpen","arguments":{"changedFiles":[],"closedFiles":["^untitled:Untitled-1"],"openFiles":[]}}
Info 135 [12:03:17.700] Project '/dev/null/inferredProject1*' (Inferred)
Info 135 [12:03:17.700] Files (7)
Info 135 [12:03:17.700] -----------------------------------------------
Info 135 [12:03:17.700] Open files:
Info 135 [12:03:17.700] FileName: /Users/matb/projects/san/e.ts ProjectRootPath: /Users/matb/projects/san
Info 135 [12:03:17.700] Projects: /dev/null/inferredProject1*
Perf 135 [12:03:17.700] 33::updateOpen: elapsed time (in milliseconds) 0.3229
Info 136 [12:03:17.700] response:
{"seq":0,"type":"response","command":"updateOpen","request_seq":33,"success":true,"body":true}
Info 137 [12:03:17.897] request:
{"seq":34,"type":"request","command":"updateOpen","arguments":{"changedFiles":[],"closedFiles":[],"openFiles":[{"file":"^untitled:Untitled-1","fileContent":"11\n","projectRootPath":"/Users/matb/projects/san","scriptKindName":"TSX"}]}}
Info 138 [12:03:17.898] Starting updateGraphWorker: Project: /dev/null/inferredProject1*
Err 139 [12:03:17.955] Exception on executing command {"seq":34,"type":"request","command":"updateOpen","arguments":{"changedFiles":[],"closedFiles":[],"openFiles":[{"file":"^untitled:Untitled-1","fileContent":"11\n","projectRootPath":"/Users/matb/projects/san","scriptKindName":"TSX"}]}}:
Debug Failure. Expected 4 === 3. Registered script kind should match new script kind.
Error: Debug Failure. Expected 4 === 3. Registered script kind should match new script kind.
at Object.getOrCreateSourceFileByPath [as getSourceFileByPath] (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:149050:34)
at tryReuseStructureFromOldProgram (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:106865:28)
at Object.createProgram (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:106396:29)
at synchronizeHostData (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:148973:26)
at Proxy.getProgram (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:149065:13)
at InferredProject.Project.updateGraphWorker (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:153950:53)
at InferredProject.Project.updateGraph (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:153880:42)
at ProjectService.assignOrphanScriptInfoToInferredProject (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:156048:25)
at ProjectService.assignProjectToOpenedScriptInfo (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:157605:26)
at /Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:157879:97
at Object.flatMap (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:515:25)
at ProjectService.applyChangesInOpenFiles (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:157879:41)
at Session.handlers.ts.Map.ts.getEntries._a.<computed> (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:158934:46)
at /Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:160818:88
at IOSession.Session.executeWithRequestId (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:160809:28)
at IOSession.Session.executeCommand (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:160818:33)
at IOSession.Session.onMessage (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:160844:35)
at Interface.<anonymous> (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:163507:31)
at Interface.emit (events.js:315:20)
at Interface._onLine (readline.js:329:10)
at Interface._normalWrite (readline.js:474:12)
at Socket.ondata (readline.js:186:10)
at Socket.emit (events.js:315:20)
at addChunk (_stream_readable.js:295:12)
at readableAddChunk (_stream_readable.js:271:9)
at Socket.Readable.push (_stream_readable.js:212:10)
at Pipe.onStreamRead (internal/stream_base_commons.js:186:23)