Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Autocomplete Next #4364

Closed
Closed

Description

@benogle

We're not quite ready to tackle a new autocomplete yet, but I wanted to start the conversation as there are several folks interested in working on autocomplete: @mark-hahn, @lee-dohm, @joefitzgerald, @abe33.

Once we finish with API related things, I was planning on:

Then I would come up with a plan of attack for the new version. In my mind, we have a couple options:

  • Extend autocomplete with an API
  • Take over autocomplete-plus with some modifications and API changes
  • Write something completely new

I am not sure what the best way forward is right now. I do feel, though, that the hard part is not the UI that pops up the completion box, it's having great language support, and a nice API for adding completions.

It would be great if you guys could help me / us work through the research phase. Off the top of my head, I'm thinking these would be a big help:

  • Your opinions and suggestions for the provider API.
  • Your architectural suggestions (I know @mark-hahn wrote one recently)
  • Comments explaining the pitfalls and your frustrations of the current autocomplete-plus API. Maybe suggestions on improvements.
  • Links to autocomplete providers for languages (either generic providers or for other editors)
  • Explanations / links to APIs in other editors
  • General autocomplete API related frustrations and desires

Resources

Providers

Autocomplete+ providers

https://github.com/atom-community/autocomplete-plus/wiki/Autocomplete-Providers

Activity

  1. self-assigned this
    on Dec 2, 2014
  2. park9140 commented on Dec 2, 2014

    @park9140

    Just to add some research, I have been using HaxeIDE/atom-autocomplete-plus-async in my park9140/atom-typescript-tools. It is a fork of autocomplete-plus with async support, and seems to work well.

  3. edubkendo commented on Dec 2, 2014

    @edubkendo

    I'm the author of https://atom.io/packages/rsense and https://atom.io/packages/racer, and I've also implemented rsense completions for sublime text and worked on it for emacs and vim. I have found the autocomplete plus provider api to be quite nice to work with, except for the fact that it is not async. This has required some hackery and global state manipulation , and means that it occasionally acts buggy since fetching completions from external sources is essentially an asynchronous act.

    Sublime Text has an ok completions API, though its thoroughly undocumented or at least was when I last checked. The nice thing there is that the API is built into the editor and you don't have to tell the user to install some other thing besides your plugin.

    Emacs and Vim have both been more difficult.

  4. joefitzgerald commented on Dec 2, 2014

    @joefitzgerald
    Contributor

    omnisharp-atom also makes use of autocomplete-plus-async.

    @nathansobo has an interesting PR including some modernization of autocomplete, which needs to be upstreamed to autocomplete-plus: atom-archive/autocomplete#54

    It seems like a prudent short-term course of action might be to:

    1. Upstream Remove usage of deprecated APIs atom-archive/autocomplete#54 to autocomplete-plus
    2. Evolve the autocomplete-plus provider API to be async, preserving the ability for providers to stay synchronous if they choose (while unwittingly still being async) - the easiest way to do this initially might be via callbacks
    3. Upstream autocomplete-plus to autocomplete
    4. End-of-life autocomplete-plus, autocomplete-plus-async and derivatives

    This then presents an opportunity for the autocomplete package to take one of two paths:

    1. Progressively evolve the package
    2. Start fresh and provide a migration for providers to a redesigned version

    There has been some discussion of modernization of the AutocompleteView, to HTMLElement or React. @abe33 is investigating further, at the direction of @nathansobo.

  5. abe33 commented on Dec 2, 2014

    @abe33
    Contributor

    Evolve the autocomplete-plus provider API to be async, preserving the ability for providers to stay synchronous if they choose (while unwittingly still being async) - the easiest way to do this initially might be via callbacks

    I would advocate for a promise-based API, the provider just have to return a promise to use the async API, if it want to stay synchronous, it just have to return an array instead. No changes needed for providers that already works in a synchronous fashion.

    I do feel, though, that the hard part is not the UI that pops up the completion box, it's having great language support, and a nice API for adding completions.

    Agreed, but there's some use cases that should be considered early, like icons in the results (for statically typed languages IDE it's rather common to have the type and the visibility of a property/method as an icon), or for displaying colors as I did in the project-palette-finder.

    Your opinions and suggestions for the provider API.

    I would like to see an option to limit the scope of a provider to a specific list of scopes. This would lessen the burden on providers authors and limit the performance hit of having all the providers running at the same time. A provider could just provides a default list (empty lists matches all scopes), that could be modified later by the user from a setting (maybe a dynamically created setting for each registered providers) so that every providers can be managed from a single page.

    Also I would like to see a unified way to compute suggestion scores, with fuzzy filtering being part of the basic autocomplete package (as a helper method so that provider doesn't have to implement that on their own).

    Links to autocomplete providers for languages (either generic providers or for other editors)

    project-palette-finder provider

  6. benogle commented on Dec 2, 2014

    @benogle
    ContributorAuthor

    Thanks to everyone so far. Keep them coming.

    It seems like a prudent short-term course of action might be to ... Evolve the autocomplete-plus provider API to be async...

    I'd rather think long term though. I'm not sure if updating autocomplete-plus is the best course of action. I would hate to change the API, get people to update their providers, then do something for the long term like rewrite autocomplete, and require people to update or recreate their providers again.

  7. mark-hahn commented on Dec 2, 2014

    @mark-hahn
    Contributor

    Evolve the autocomplete-plus provider API to be async...

    I don't see how this solves anything. If a provider is synchronous and it
    takes over a thread the callbacks help nothing. It has to be in a separate
    process.

    On Tue, Dec 2, 2014 at 11:18 AM, Ben Ogle [email protected] wrote:

    Thanks to everyone so far. Keep them coming.

    It seems like a prudent short-term course of action might be to ... Evolve
    the autocomplete-plus provider API to be async...

    I'd rather think long term though. I'm not sure if updating
    autocomplete-plus is the best course of action. I would hate to change the
    API, get people to update their providers, then do something for the long
    term like rewrite autocomplete, and require people to update or recreate
    their providers again.

    —
    Reply to this email directly or view it on GitHub
    #4364 (comment).

  8. joefitzgerald commented on Dec 2, 2014

    @joefitzgerald
    Contributor

    @mark-hahn it's a matter of progressive elaboration. The API needs to support asynchronous suggestions. That does solve problems associated with external / daemon-based processes that provide suggestions (e.g. gocode, OmniSharp, etc.).

    That doesn't preclude further enhancing the way providers are called to move them off to a separate process. That wouldn't / shouldn't change the API itself.

  9. edubkendo commented on Dec 2, 2014

    @edubkendo

    I don't see how this solves anything. If a provider is synchronous and it
    takes over a thread the callbacks help nothing. It has to be in a separate
    process.

    @mark-hahn

    Because many providers work by calling out to a tool that runs in an external process, gocode, rsense and racer are 3 examples that work like this. The API's for spawning or executing those processes are async API's. Whereas autocomplete-plus's provider API is synchronous, and because of the way it works, leaves you doing hacky things like setting completions on a class var and hoping you don't hit race conditions (which , of course, you do). It's an entirely different problem from the one where a process blocks the thread.

  10. park9140 commented on Dec 2, 2014

    @park9140

    I have been working with the autocomplete-plus-async package and one of the primary issues that seems to pop up with async is that we get race conditions between the debounced change event, and the request for autocomplete. This presents as showing and working with an autocomplete list that is in the process of being replaced, and depending on how fast you are tab completing you can end up selecting a completion that is not what you expect.

    I also would like to spend some on the plugin architecture. Many of us have put a lot of work into plugin architecture for the AtomLinter project, and we seem to have a pretty solid methodology there. There is significant amount of registration and management of the related dependent plugins that could be rolled into a common library for use in all of these type of projects.

  11. joefitzgerald commented on Dec 2, 2014

    @joefitzgerald
    Contributor

    I'd rather think long term though. I'm not sure if updating autocomplete-plus is the best course of action.

    I'm not saying don't think long term 😄. Just simply suggesting that in the short term there are some achievable quick wins that would move the ball forward while giving you the option of further evolving from the base autocomplete package if / when the packages are consolidated.

    I would hate to change the API, get people to update their providers, then do something for the long term like rewrite autocomplete, and require people to update or recreate their providers again.

    I think implicit in the suggestions I'm making is that existing providers would not have to make changes in the short term until the long term API changes occur. But we can switch to async while being backwards compatible - just requires that we enhance the provider to include a function that is async (handleSuggestionRequest? buildSuggestionsAsync?) that calls the synchronous method (buildSuggestions by default, but which can be overridden by async providers.

    When I first started contributing to the discuss thread, I was of the opinion we should throw everything away and start fresh. I've since evolved my thinking to prefer enhancing autocomplete-plus, upstreaming autocomplete-plus > autocomplete, and then enhancing autocomplete (with an optional complete rewrite with temporary support for the current autocomplete-plus API).

    The reasons why I changed my opinion include:

    • This provides a clear migration path for existing autocomplete-plus providers, and might achieve consolidation of the autocomplete package ecosystem relatively quickly
    • This moves the issue burden and maintenance to a single repo in the interim, while the long term solution is worked on
    • This potentially removes conflicts between the various autocomplete derivatives, lowering overall autocomplete churn and the perception that it is fragmented
    • This allows gocode functionality in my package to move more quickly to depend on a core package and consequently potentially benefit from changes to the core that are orthogonal (but related) - e.g. the rewrite of select-list-view to use HTMLElement - when these changes occur in the core, packages on the periphery like autocomplete-plus are not included in the migration, as they don't fail your tests 😉
  12. mehcode commented on Dec 3, 2014

    @mehcode
    Contributor

    Code-completion is so much more than auto-completion. It can be achieved with auto-completion but we need to make sure that auto-completion is flexible enough.

    Some thoughts:

    • Context — If I type self. (python) I should (using jedi or something similar as the provider) be given only the attributes on self. If I am typing inside a method and I start typing appl and there is a local variable applesauce but a global variable apple the local variable should (in my opinion) have a higher weight / confidence in the suggestion box.
    • Meta — Just the name of the symbol is not enough. When I type print( I should get a pop-up under my cursor explaining just what print is (depends on the provider, using python again it should be doc comments). Going even further, when I type format("hello",, the , should trigger some event to the provider so it could update the documentation to show the parameter that I'm on position-ally.
    • Defer — Providers should be able to defer to other providers. Take C++ for example this time. If I type #include < I should now be auto-completing a path with the system include directories weighed higher and if I type #include " I should be auto-completing a path with the current directories weighed higher.

    In the immediate future just a solid name / symbol completion would be awesome but the above are some next-level thoughts following the title of this issue.

  13. joefitzgerald commented on Dec 3, 2014

    @joefitzgerald
    Contributor

    @mehcode Regarding Context, there are multiple implementations of autocomplete-plus (or derivatives) providers which do exactly as you describe.

    In the case of my package (go-plus), I use a daemon called gocode which understands the context of the current cursor position and provides suggestions that are contextually correct.

    Context is language specific, and so determining context is deemed to be in the realm of the autocomplete Provider rather than the core package itself. Some Providers may be bundled with the core package which blurs the lines somewhat.

    I think your Meta item is also language-specific and up to each provider. It does raise a question though: "what should a suggestion look like?". Right now, it's fairly sparse, but could be richer.

    Defer is interesting, in so far as the example you provide (filesystem paths) could be a centrally provided suggestion, but also could reside in the realm of the provider.

  14. 29 remaining items

  15. benogle commented on Mar 5, 2015

    @benogle
    ContributorAuthor

    This is happening. I cant commit to a specific date, but autocomplete-plus will be the main deal soonish.

  16. russlescai commented on Mar 6, 2015

    @russlescai
    Contributor

    👍

  17. brendanfalkowski commented on Mar 11, 2015

    @brendanfalkowski
  18. joefitzgerald commented on Mar 11, 2015

    @joefitzgerald
    Contributor

    Markup closing would be a great core feature for the autocompleter: https://github.com/mrhanlon/less-than-slash

    That wouldn't be a core feature but it sounds like a great provider. Would be cool if the current package converted to become an autocomplete-plus provider.

  19. brendanfalkowski commented on Mar 11, 2015

    @brendanfalkowski

    @joefitzgerald Ah, I'll suggest there. Maybe wrong word choice, meant: would be nice if "Atom just behaved this way by default" rather than it belongs in this package specifically. This seemed like the right place among the roadmap tasks.

  20. sandstrom commented on Mar 15, 2015

    @sandstrom

    A wish would be 'inline-autocomplete', i.e. an UI-less mode where a keypress will rotate among the alternatives (similar to how it works in Textmate). To be clear, this should be an opt-in mode, not mandatory.

    This package supports this, but it's not as nicely integrated with Atom as the regular autocomplete package, and since this is a core feature of an editor I'd much prefer using an official package.
    https://atom.io/packages/inline-autocomplete

  21. steelbrain commented on Mar 16, 2015

    @steelbrain
    Contributor

    -1 for inline-autocomplete.
    Because I use autocomplete to not only get autocomplete but to also get the type of the variable, for example, identify if it's a Map<string,mixed or Map<string,string.

    Auto-Complete-Plus provides a label attribute that serves this purpose grealy.

  22. sandstrom commented on Mar 16, 2015

    @sandstrom

    @steelbrain I'm thinking of an optional, opt-in, mode. You wouldn't be forced to use it.

  23. benogle commented on Mar 16, 2015

    @benogle
    ContributorAuthor

    A wish would be 'inline-autocomplete',

    I think this should be a separate package. For the people who want this behavior, they can disable the default, and install an inline-autocomplete package.

  24. zslabs commented on Apr 8, 2015

    @zslabs

    Just throwing in my +1 on an AutoComplete system that can stand-up against PHP Storm's. For example, working in a Laravel app, if I start typing:

    Route

    it gives me options on what class to import and even tells me when I have imported classes that are not in use in the current doc, which is fantastic. This is the ONLY feature that is keeping me from moving to Atom full-time -- right now it's just for frontend work.

    https://www.jetbrains.com/phpstorm/help/class-name-code-completion.html

  25. benogle commented on Apr 8, 2015

    @benogle
    ContributorAuthor

    @zslabs out of the box, it wont provide PHP intelligence. We will be bundling autocomplete-plus in the near future. You can install it today and get a much better experience over the built-in autocomplete. You may get some mileage out of @steelbrain's atom hack package. Also, I do know facebook will be soon releasing nuclide soon, which will include hack tooling, likely with autocomplete providers for PHP.

  26. benogle commented on Apr 8, 2015

    @benogle
    ContributorAuthor

    A note to everyone following this issue: there is a plan for bundling autocomplete-plus with core outlined in https://github.com/atom-community/autocomplete-plus/issues/351

    I'm locking this issue. Please comment or question on the autocomplete-plus issue!

  27. locked and limited conversation to collaborators on Apr 8, 2015
  28. locked and limited conversation to collaborators on Apr 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions