-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
Multiple formatters from the same extension cause choices for default formatter to be not helpful #72315
Comments
That's the problem, you should not register two providers and ignore one because that's not how the integration works. Calling register does something, like updating the UI et al, and that's nothing to be toyed with. Your proposed solution doesn't work because the picker comes before calling a formatter. You extension should have default values and honour that, e.g register formatter A only, on setting change unregister A, register B etc |
The described behavior is how it is expected to work. If you disagree, please explain what is expected and what is not in more detail. See also our issue reporting guidelines. Happy Coding! |
Thanks @jrieken To unregister a registered provider, do we just call |
yes, |
And is there a way to unregister the provider from the language server? |
sure, see this: #70314 (comment) |
The
vscode-go
extension gives language server support for the user to opt-in to.Using settings, we allow user to pick and choose the features they would want to use language server for.
For example, a user can choose to use the language server, but choose not to use its formatting features.
The way we accomplish this is by having the extension register a formatting provider and use middleware to ignore formatting results from language server.
This results in 2 formatters for the extension. VS Code prompts the user to select the default formatter which results in the below:
It confuses users to see both options with the same name.
If they choose the one that is meant for language server, then they won't get any formatting edits.
Proposed solution:
If one of the registered providers returns empty results, do not consider it as one of the multiple formatters and thus avoid the prompt to select the default provider.
The text was updated successfully, but these errors were encountered: