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

@aschlaep aschlaep commented Apr 29, 2019

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

@jupyterlab-dev-mode jupyterlab-dev-mode bot commented Apr 29, 2019

Thanks for making a pull request to JupyterLab!

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

Loading

Copy link
Member

@blink1073 blink1073 left a comment

Looks good, just a couple docs items. Thanks!

Loading

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

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

@blink1073 blink1073 May 1, 2019

Choose a reason for hiding this comment

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

Missing docstring?

Loading

* @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

@blink1073 blink1073 May 1, 2019

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?

Loading

@aschlaep
Copy link
Member Author

@aschlaep aschlaep commented May 1, 2019

Thanks, good catches!

Loading

@blink1073 blink1073 merged commit a646606 into jupyterlab:master May 2, 2019
9 of 10 checks passed
Loading
@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.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants