Repository navigation
Singleton AutocompleteManager, Separate View's Model From AutocompleteManager - #186
Conversation
- Switch to singleton AutocompleteManager, decouple model/view from specific editor/editorView - Tests fail everywhere, but the package is functional with go-plus
- Integrate service-hub for new Provider API - Support prior API as v1.0.0 - New API registers providers for scopes (fixes #171)
|
@nathansobo This PR integrates |
- Temporary Fix, Pending Deprecation Of Provider And Migration Of Providers Away From Provider Class - Add Config For Scope Blacklist - Add Title And Description To Config
|
@joefitzgerald Awesome. I'll take a look today. |
There was a problem hiding this comment.
currentPaneItem could be something other than an editor. In which case we should deregister the current editor and cancel any current autocomplete.
There was a problem hiding this comment.
Yes, that's still a TODO. How should we restrict what a 'valid' editor is?
- Temporary, legacy measure
There was a problem hiding this comment.
Minor suggestion: Could you bundle up the various disposables associated with an editor/buffer into a single CompositeDisposable?
There was a problem hiding this comment.
We do maintain a CompositeDisposable but we cannot use that for buffer / editor events, because we have a single AutocompleteManager which is subscribing / unsubscribing as pane items change.
Consequently we need to explicitly track those subscriptions - hence the code is the way it is.
There was a problem hiding this comment.
We could create a composite disposable when doing editor subscriptions and only store an clear that one when we detatch from a given editor. If we have to bind to more events in the future this would make the pattern more explicit.
There was a problem hiding this comment.
I like it. 👍 Sorry, a little slow on the uptake on that one.
- Both Are TODO
There was a problem hiding this comment.
We should break this out into a ProviderManager component. Since the job of the AutocompleteManager is to handle the editor and editor interactions.
There was a problem hiding this comment.
AutocompleteManager is to handle the editor and editor interactions.
Is it? I mean, I suppose it could be its sole purpose, but I think the Provider API makes sense there too, at least for now.
There was a problem hiding this comment.
I'd lobby for it just to help keep this file from being so enormous.
There was a problem hiding this comment.
Okie dokie. Extracting.
- Assists in tests, allows interested parties to act on event - Guard against @providers being null during dispose
- Ensure disposed providers are unregistered after they are disposed - Fixes #88
- Preference Is Given To Earlier Suggestions - Fixes #84
|
@nathansobo This is ready to 🚢. Would appreciate your review of the code as it currently stands. This includes use of scoped-property-store for storage of provider registrations and the global / provider blacklists. We have also inverted the service-hub directionality, |
- Convention is: <package-name>-<provider-name>
- Next step, insertion of anonymous snippets
…tom-community/autocomplete-plus into singleton-autocomplete-manager Conflicts: lib/autocomplete-manager.coffee
…nager Singleton AutocompleteManager, Separate View's Model From AutocompleteManager
This PR seeks to change
autocomplete-plussuch thatAutocompleteManageris a singleton.select-list-elementtosuggestion-list-elementsuggestion-listmain.coffeeto manage a singleAutocompleteManagerinstancesuggestion-list-elementacross editorsundoproperly #125