move LSP serve method to main cli crate and fix shutdown handling #143
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
closes #142
Okay, this at least fixes the issue with the process not being killed when the editor quits and stdin/stdout is closed. But there's some issues with I assume the unique way we have the Python entrypoint and PyO3 not handing off ... something? The result handling at the end of the cli run method doesn't actually get hit, so you have to process exit in the serve method. Who knows????
This also moves the tokio business just into the serve command, as well as creates some boilerplate for exiting. Could have used an external crate for this -- there are a few -- but it seemed simple enough so I just brought it in.
Still can't handle Ctrl-C quitting the serve command when just running in the terminal, but you can hit enter to force a parse error and crash the thing. I may revisit that later, but since this isn't designed to be run in the terminal maybe a simple log about that not being supported and a note about hitting enter to exit will do fine.