daveoftheparty / speedy-moq

Generate boilerplate code for Moq in C#
MIT License
1 stars 0 forks source link

code action and diagnostic persist after quick fix applied #3

Closed daveoftheparty closed 3 years ago

daveoftheparty commented 3 years ago

Right now, TextDocHandler is hardcoding a diagnostic as a POC. CodeActionHandler is reading that diagnostic and suggesting a quick fix.

It's possible the only reason the diagnostic & lightbulb aren't going away is because the diagnostic is being published more than once. I tried to put a boolean in there to detect that, however, I'm not sure the boolean is keeping the diagnostic from being published more than once. This MIGHT be because Omni might create a new instance of our handler class every "once in a while" on new requests from the IDE.

Possible detection scenarios: declare a readonly GUID in TextDocHandler and include it in the log string when publishing diagnostics. Check the trace logs to see if the GUID is being dumped more than once. If it's not... is a new GUID being dumped instead? That would indicate a new instance of the class is being instantiated by the Omni library.

Either we need to somehow "clear" the diagnostic after the code action, OR, it's not going away because we just keep publishing it over and over. Let the logs run a while (type/save/type/save in a dummy .cs file and do some searching on the logs.)

daveoftheparty commented 3 years ago

Oh, forgot to note: I took a trace of something else... a known quantity. More Omni, but NOT Omni LSP... the Omni C# extension that we use to develop C# in vscode with. So I turned on verbose tracing and performed a quick action. Some logs/readme and pics are in the folder ./omnisharp-ctor-inject-log