Skip to content

Add a signal to proxy all Completer.selected signals#16312

Merged
krassowski merged 4 commits into
jupyterlab:mainfrom
ajbozarth:signal
May 16, 2024
Merged

Add a signal to proxy all Completer.selected signals#16312
krassowski merged 4 commits into
jupyterlab:mainfrom
ajbozarth:signal

Conversation

@ajbozarth

Copy link
Copy Markdown
Member

References

Fixes #16294

Code changes

Completer currently emits a signal (_selected) when a completion is selected. This PR creates a new signal in CompletionProviderManager, which proxies the Completer signal from every CompletionHandler that is generated.

This will allow extensions to know when a selection is made by any Completer. Currently there are edge cases (as listed in #16294) where a selection can be made without calling a command that can be connected to.

Completer currently emits a signal when a completion is selected.
This surfaces that signal to the CompletionProviderManager, which
then proxies all the Completer signals to the new signal.

This will allow extensions to know when a selection is made in a
Completer. Currently there are edge cases where a selection can be
made without calling a command that can be connected to.

Signed-off-by: Alex Bozarth <ajbozart@us.ibm.com>
@ajbozarth ajbozarth requested a review from krassowski May 9, 2024 20:10
@ajbozarth ajbozarth self-assigned this May 9, 2024
@jupyterlab-probot

Copy link
Copy Markdown

Thanks for making a pull request to jupyterlab!
To try out this branch on binder, follow this link: Binder

@ajbozarth

Copy link
Copy Markdown
Member Author

@krassowski here's my implementation I pitched in #16294 based on your idea:

a high level signal which would proxy Selected from all widgets.

I'm still open to other solutions, but figured I would implement and submit this PR since it was pretty easy to do so. I've also tested that it does solve my problem

Comment thread packages/completer/src/manager.ts Outdated
@krassowski krassowski added this to the 4.3.0 milestone May 11, 2024
Comment thread packages/completer/src/tokens.ts Outdated
Comment thread packages/completer/src/manager.ts

@krassowski krassowski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you @ajbozarth!

@krassowski krassowski merged commit e34aad0 into jupyterlab:main May 16, 2024
@krassowski krassowski changed the title Add Signal to proxy all Completer selected Signals Add a signal to proxy all Completer.selected signals May 16, 2024
@ajbozarth ajbozarth deleted the signal branch May 16, 2024 13:58
ImpSy pushed a commit to spotinst/jupyterlab that referenced this pull request Jan 7, 2025
* Add Signal to proxy all Completer selected Signals

Completer currently emits a signal when a completion is selected.
This surfaces that signal to the CompletionProviderManager, which
then proxies all the Completer signals to the new signal.

This will allow extensions to know when a selection is made in a
Completer. Currently there are edge cases where a selection can be
made without calling a command that can be connected to.

Signed-off-by: Alex Bozarth <ajbozart@us.ibm.com>

* Emit ICompleterSelection instead of string

* change text to insertText

* add new test for selected

---------

Signed-off-by: Alex Bozarth <ajbozart@us.ibm.com>
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators May 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No consistent way to execute a callback function upon acceptance of a Completer item

2 participants