When enabling the option to follow the currently selected solution in Omnisharp and not being in a workspace where Omnisharp has already activated a ton of errors were being produced due to improperly accessing the extension.exports field when the extension has not yet activated. As the docs for the export field mention:
The public API exported by this extension (return value of `activate`).
It is an invalid action to access this field before this extension has been activated.
This PR removes the type cast to any when getting the Omnisharp extension and checks for the isActive flag before accessing the API. I also decided to add an interface corresponding directly to the concrete event as currently defined in Omnisharp for slightly more clarity.
At the same time I think that this extension should probably not even be activated in contexts where Omnisharp doesn't also already define its own activation events, but I haven't thought about that part enough at this point.
When enabling the option to follow the currently selected solution in Omnisharp and not being in a workspace where Omnisharp has already activated a ton of errors were being produced due to improperly accessing the
extension.exports
field when the extension has not yet activated. As the docs for theexport
field mention:This PR removes the type cast to
any
when getting the Omnisharp extension and checks for theisActive
flag before accessing the API. I also decided to add an interface corresponding directly to the concrete event as currently defined in Omnisharp for slightly more clarity.At the same time I think that this extension should probably not even be activated in contexts where Omnisharp doesn't also already define its own activation events, but I haven't thought about that part enough at this point.