-
Notifications
You must be signed in to change notification settings - Fork 148
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
Refactor completer to support external providers #600
Conversation
5f91657
to
4a745d6
Compare
waitForBusyKernel: boolean; | ||
} | ||
|
||
export class KernelCompletionProvider implements ICompletionProvider { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make it into an extension (enabled by default) and then disable it in lsp extension using: https://jupyterlab.readthedocs.io/en/stable/extension/extension_dev.html?#disabling-other-extensions
source: { | ||
name: 'LSP', | ||
priority: 2 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Show language server name here?
- Think about allowing completions from multiple language servers; these would be just different sources (one provider can provide completions from multiple sources). The change would be in using multiple connections in a loop rather than a single connection.
Hi Michal, this is great. I love the idea of having providers! I have a couple of questions regarding the
Thanks for starting this refactor! |
I wanted to bring it up today on dev meeting.
Yes, but not only. The thing is that upstream model is rigid when it comes to the type of items ( export class GenericCompleterModel<T extends CompletionHandler.ICompletionItem> extends CompleterModel {
public settings: GenericCompleterModel.IOptions;
completionItems(): T[];
/** ... **/
} This can be seamlessly up-streamed by setting a default Also there are some fixes to HTML escaping. |
Why don't we try to improve the |
I think would be fine to change it and improve it. |
Yes I was a proponent of using ranks back in the day but today I think that using I see some benefits of separating filter from sort but I am not fully convinced yet. Indeed providers could implement their own filter, but this might confuse the user due to potentially inconsistent behaviour. I believe we should use harmonized |
CC @edzkite as this might make your code base so much cleaner once this gets moved into JuptyerLab core. Actually I have an important question: would the dynamic details (e.g. documentation) fetching implementation that I use, this is having each item as an object with getters (e.g. |
4a745d6
to
321a341
Compare
Closing in favour of jupyterlab/jupyterlab#11795 and jupyterlab/jupyterlab#11969 - big changes coming with JupyterLab 4.0 :) |
References
Closes #236 and closes #440. Addresses https://github.com/krassowski/jupyterlab-lsp/issues/208#issuecomment-813589346.
Very early WIP, probably broken (not tested yet). TODO:
Code changes
@krassowski/completion-manager
(which hopefully - after improvements - will end up in@jupyterlab/
for JupyterLab 4.0) hosting:ICompletionProviderManager
token (CompletionManager
is already taken by the core) - this is what other extensions should use to register custom providers (ICompletionProviderManager.register(provider)
)ICompletionProvider
- this is interface that the providers in other extensions should implement; it gets more situational awareness than the core lab offers, providing ICompletionsReply with trigger information and additional CompletionContext); it also allows to provide custom renderer (which will be used on completions from this provider) and describe the source of completions.IExtendedCompletionItem
,ICompletionsReply
,ICompleterRenderer
- this allows us to add new functionality easily before it gets added to the "core completer" (or at all for features that might never make it into the core completer)User-facing changes
None. All settings remain as they were; the refactor allows us to add new settings, but for simplicity sake I believe we should avoid it for now as it would be a breaking change (I'm thinking it should accompany 3.1 or 4.0 lab release as those will be breaking anyways).
Backwards-incompatible changes
Every extension that relied on our internal completer implementation (which I believe is none in the open-source realm) will be impacted.
Chores