Return errors instead of panics
tsgo heavily overuses panics, that can lead to the situations mentioned in #631:
The typescript-go-lsp server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
PR is intended to start moving the codebase towards more idiomatic error handling. Atm, I've changed 2 panics and we probably need to agree on the approach: I can keep adding changes to this PR, but it'll be big and hard to follow, or I can create a separate PRs to keep them small and simple.
@microsoft-github-policy-service agree
I think this PR should be closed. In general, TS panics when something is badly broken, and things are commonly broken in Corsa's preview state. In the language server case, I predict we'll continue to use panics, and then handle panics in a central place.