Should fix #2418 and dhall-lang/vscode-dhall-lsp-server#37
The problem was that exceptions which were handled in the interpretHandler basically shut down the entire server, so after a few attempts vscode just gave up and the server was entirely shut down.
I've tried to keep top ExceptT monad as it is very handy and move error handling into the request handlers themselves. Since they have to return something, I first tried to just respond with an error, like: respond (Left (ServerError {..})). Unfortunately it immediately brings up output panel with protocol error messages, which is quite annoying, and likely should be resolved for some serious errors that need user attention. In the end I've decided on returning an empty value in the handleErrorWithDefault.
I'm a bit rusty with haskell, so there may be more elegant solution.
Also I've added stubs for missing handlers to prevent annoying error messages which bring up Output panel.
P.S.: I've played a bit in VSCode and diagnostics feels like really snappy and responsive. The only thing that is still annoying is in case of a failed import whole file is in error not just the offending import location, otherwise it's really good.
Should fix #2418 and dhall-lang/vscode-dhall-lsp-server#37
The problem was that exceptions which were handled in the
interpretHandler
basically shut down the entire server, so after a few attempts vscode just gave up and the server was entirely shut down.I've tried to keep top
ExceptT
monad as it is very handy and move error handling into the request handlers themselves. Since they have to return something, I first tried to just respond with an error, like:respond (Left (ServerError {..}))
. Unfortunately it immediately brings up output panel with protocol error messages, which is quite annoying, and likely should be resolved for some serious errors that need user attention. In the end I've decided on returning an empty value in thehandleErrorWithDefault
. I'm a bit rusty with haskell, so there may be more elegant solution.Also I've added stubs for missing handlers to prevent annoying error messages which bring up Output panel.
P.S.: I've played a bit in VSCode and diagnostics feels like really snappy and responsive. The only thing that is still annoying is in case of a failed import whole file is in error not just the offending import location, otherwise it's really good.