OmniSharp / omnisharp-emacs

Troll coworkers - use Emacs at work for csharp!
GNU General Public License v3.0
514 stars 90 forks source link

Restarting the server breaks flycheck for open buffers #283

Open razzmatazz opened 7 years ago

razzmatazz commented 7 years ago

I have noticed that each time I restart the server manually all the .cs buffers have their flycheck in "defunct mode", i.e. I need to re-open the file to get flycheck check that buffer again.

razzmatazz commented 7 years ago

The problem appears to be because we're breaking flycheck contract in :start handler for flycheck-define-generic-checker which is omnisharp--flycheck-start on our side.

Flycheck documentation on flycheck-define-generic-checker is explicit on this by saying:

I think there are two sequences that can trigger the problem:

To fix this we probably need to:

mikavilpas commented 7 years ago

I like the idea of having a timeout callback. Or would it be a generic error callback?

razzmatazz commented 7 years ago

I would sugest a general callback, because it could as well be "server-error" or "server-disconnected/terminated" or something else, not just a timeout.. What do you think? Maybe you have a better idea..

I didn't read the code that much yet to be able to tell if passing nil or some kind of error value to response-handler would break more things than fix :), rather than adding a new &optional callback parameter to omnisharp--send-command-to-server..

mikavilpas commented 7 years ago

I think a general error handler would be the best. Maybe also the simplest to implement. I think the server doesn't classify its responses as successful or failed ones, so we'd have one for a timeout, and another one for an exception of some kind. Can you think of something else?

On Apr 4, 2017 11:15, "Saulius Menkevičius" notifications@github.com wrote:

I would sugest a general callback, because well it could as well be "server-error" or "server-disconnected/terminated" or something else, not only a timeout.. What do you think? Maybe you have a better idea..

I didn't read the code that much yet to be able to tell if passing nil or some kind of error value to respone-handler would break more things than fix :), rather than adding a new parameter to omnisharp--send-command-to- server..

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/OmniSharp/omnisharp-emacs/issues/283#issuecomment-291427309, or mute the thread https://github.com/notifications/unsubscribe-auth/AASW978J-fpOwEbYx0GvBEfKxs4vwWruks5rsfw7gaJpZM4MTCFt .

razzmatazz commented 7 years ago

Do you mean, a handler that is set globally, not via omnisharp--send-command-to-server? But then we wouldn't be able to invoke flycheck result handler of a particular failed request from a global handler.

razzmatazz commented 7 years ago

Yes, this is probably more like 'crash'/'connection error' handler rather than "error" response from a working server.

razzmatazz commented 6 years ago

Removing from 4.2, doesn't happen at least for me that often.