microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
100.98k stars 12.48k forks source link

Harden response delivery to ensure services is consistent with server #44260

Open DanielRosenwasser opened 3 years ago

DanielRosenwasser commented 3 years ago

Spoke with @andrewbranch

If you [add] a member to any protocol.*Response, there's a significant chance that your fourslash tests [will] work but it [won't] actually work over the TS Server because session.ts picked apart the response in the process of converting positions to line/character and didn't know to put it back

How could we fix it?

Destructuring with an object rest instead of requiring session.ts to name every property it wants to preserve

andrewbranch commented 3 years ago

Primary example: https://github.com/microsoft/TypeScript/blob/b7b48569447779399c922f5fd9b2a055375b07e8/src/server/session.ts#L1842