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

Remove deregisterProvider from SearchProviderRegistry interface #6282

Merged

Conversation

aschlaep
Copy link
Member

References

Addresses an issue brought up in #6217.

Code changes

This removes the deregisterProvider function on ISearchProviderRegistry, renames registerProvider to simply register and returns a DisposableDelegate, and adds a changed signal to ISearchProviderRegistry that emits when a provider has been registered or disposed (and effectively deregistered). The goal here was to allow extensions to only 'deregister' the providers that they provide and no others.

Also, with the new signal, we can ensure that the jp-mod-searchable class that controls the ctrl + f and other search-related keybindings is added to and removed from active widgets only when they have a registered search provider.

User-facing changes

There should be no user-facing changes here, other than a slightly tighter control on when the search keybindings are routed to the browser vs a search provider when providers are registered/deregistered.

Backwards-incompatible changes

This makes three breaking changes to the ISearchProviderRegistry interface, as described above:

  1. Rename registerProvider -> register and it now returns an IDisposable
  2. Remove deregisterProvider
  3. Add changed signal

@jupyterlab-dev-mode
Copy link

Thanks for making a pull request to JupyterLab!

To try out this branch on binder, follow this link: Binder

Copy link
Member

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a couple docs items. Thanks!

@@ -85,6 +80,10 @@ export class SearchProviderRegistry implements ISearchProviderRegistry {
);
}

get changed(): ISignal<this, void> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing docstring?

* @returns true if removed, false if key did not exist in map.
*/
deregisterProvider(key: string): boolean;
register(key: string, provider: ISearchProviderConstructor): IDisposable;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing doc for the return value?

@aschlaep
Copy link
Member Author

aschlaep commented May 1, 2019

Thanks, good catches!

@blink1073 blink1073 merged commit a646606 into jupyterlab:master May 2, 2019
@lock lock bot added the status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label Aug 7, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Aug 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement pkg:documentsearch status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants