Skip to content
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

Allow providers to disable themselves #208

Closed
stefanboca opened this issue Oct 29, 2024 · 1 comment
Closed

Allow providers to disable themselves #208

stefanboca opened this issue Oct 29, 2024 · 1 comment
Labels
feature New feature or request sources Specific source provider or the system as a whole

Comments

@stefanboca
Copy link
Collaborator

I'm proposing to add a function

--- @field enabled fun(self: blink.cmp.Source, context: blink.cmp.SignatureHelpContext): bool

to blink.cmp.Source, that will allow sources to disable themselves.

I know there is already the function should_show_items on sources, but from what I understand this only hides items after a source generates completions. I also see that there is an enabled field in blink.cmp.SourceProviderConfig, but that seems to be only configurable by the user and not the source itself.

However, there are some completion providers that only make sense on, for instance, a specific file type, so having them run on all file types would be wasteful for performance.

This looks pretty simple to implement - adding the function to the source, then updating sources.get_enabled_providers to check the result of the function. If you'd like, and you agree with the change, then I can quickly submit a PR with the changes.

@Saghen Saghen closed this as completed in c104663 Oct 29, 2024
@Saghen Saghen changed the title FR: allow providers to disable themselves Allow providers to disable themselves Oct 29, 2024
@Saghen Saghen added feature New feature or request sources Specific source provider or the system as a whole labels Oct 29, 2024
@stefanboca
Copy link
Collaborator Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request sources Specific source provider or the system as a whole
Projects
None yet
Development

No branches or pull requests

2 participants