-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The language client exposed by the plugin's API can be null #721
Comments
My personal opinion is to undertake the following:
I can see two approaches to the last situation:
My preference I think is to use the first option. LMK if you want a PR. |
+1
I think we can keep things simple and do it without bumping the API version; the API is unlikely to have a lot of consumers to break at this point.
That would be great, thanks. |
Opened #727. Quite a bit of churn removing the non-null assertions, though. |
While reviewing #636, I realized that even though the extension's public API is specified to expose a non-null
BaseLanguageClient
object (rather thanBaseLanguageClient | null
), the value can in fact be null if the server binary cannot be found and this codepath is taken during plugin activation.(This technically shouldn't type-check, but it does because
ClangdContext.client
is declared asclient!: ClangdLanguageClient;
, which I guess overrides the type checker.)In #636, we are adding a second codepath where
client
can be null (the patch is adding a"clangd.enable"
setting that disables operation of the server if set to false).@thegecko do you have any thoughts on how the API should deal with this? Should we change the type of
ClangdApiV1.languageClient
toBaseLanguageClient | null
, to give API users a heads up that the value could be null? Or alternatively should we haveactivate()
returnClangdExtension | null
, where if we don't have a client we returnnull
there?The text was updated successfully, but these errors were encountered: