This repository was archived by the owner on Mar 3, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
Autocomplete Next #4364
Copy link
Copy link
Closed
Labels
Description
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:
- Looking at
autocomplete-pluscode - Checking out all of the existing providers out there.
- How many are out there? What are the popular ones?
- Looking at code @mark-hahn and @lee-dohm produced recently
- Looking at other editors. How do they do it? Do they have APIs?
- Are there autocomplete daemons out there we can use (e.g. https://github.com/nsf/gocode for Go)
Then I would come up with a plan of attack for the new version. In my mind, we have a couple options:
- Extend
autocompletewith an API - Take over
autocomplete-pluswith 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-plusAPI. 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
- Discuss thread: https://discuss.atom.io/t/what-can-we-do-to-improve-autocomplete/13001
- @mark-hahn + @lee-dohm's autocomplete: https://github.com/mark-hahn/autocomplete-generic
- https://github.com/atom-community/autocomplete-plus
- https://github.com/HaxeIDE/atom-autocomplete-plus-async
Providers
- Ruby provider: https://atom.io/packages/rsense
- Rust provider: https://atom.io/packages/racer
- Go generic provider: https://github.com/nsf/gocode
- Python generic provider: https://github.com/davidhalter/jedi
- JS: https://github.com/marijnh/tern ; https://github.com/majutsushi/tagbar/wiki#javascript
- Coffee: https://github.com/lukaszkorecki/CoffeeTags ; https://github.com/mntmn/tern-coffeescript
Activity
park9140 commentedon Dec 2, 2014
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.
edubkendo commentedon Dec 2, 2014
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.
joefitzgerald commentedon Dec 2, 2014
omnisharp-atomalso makes use ofautocomplete-plus-async.@nathansobo has an interesting PR including some modernization of
autocomplete, which needs to be upstreamed toautocomplete-plus: atom-archive/autocomplete#54It seems like a prudent short-term course of action might be to:
This then presents an opportunity for the autocomplete package to take one of two paths:
There has been some discussion of modernization of the AutocompleteView, to HTMLElement or React. @abe33 is investigating further, at the direction of @nathansobo.
abe33 commentedon Dec 2, 2014
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.
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.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).
project-palette-finder provider
benogle commentedon Dec 2, 2014
Thanks to everyone so far. Keep them coming.
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.
mark-hahn commentedon Dec 2, 2014
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:
joefitzgerald commentedon Dec 2, 2014
@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.
edubkendo commentedon Dec 2, 2014
@mark-hahn
Because many providers work by calling out to a tool that runs in an external process,
gocode,rsenseandracerare 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.park9140 commentedon Dec 2, 2014
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.
joefitzgerald commentedon Dec 2, 2014
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
autocompletepackage if / when the packages are consolidated.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 (buildSuggestionsby 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, upstreamingautocomplete-plus>autocomplete, and then enhancingautocomplete(with an optional complete rewrite with temporary support for the currentautocomplete-plusAPI).The reasons why I changed my opinion include:
select-list-viewto useHTMLElement- 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 😉mehcode commentedon Dec 3, 2014
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:
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 typingappland there is a local variableapplesaucebut a global variableapplethe local variable should (in my opinion) have a higher weight / confidence in the suggestion box.print(I should get a pop-up under my cursor explaining just whatprintis (depends on the provider, using python again it should be doc comments). Going even further, when I typeformat("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.#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.
joefitzgerald commentedon Dec 3, 2014
@mehcode Regarding
Context, there are multiple implementations ofautocomplete-plus(or derivatives) providers which do exactly as you describe.In the case of my package (
go-plus), I use a daemon calledgocodewhich 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
Providerrather than the core package itself. SomeProviders may be bundled with the core package which blurs the lines somewhat.I think your
Metaitem 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.Deferis 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.29 remaining items
benogle commentedon Mar 5, 2015
This is happening. I cant commit to a specific date, but autocomplete-plus will be the main deal soonish.
russlescai commentedon Mar 6, 2015
👍
brendanfalkowski commentedon Mar 11, 2015
Markup closing would be a great core feature for the autocompleter: https://github.com/mrhanlon/less-than-slash
joefitzgerald commentedon Mar 11, 2015
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.
brendanfalkowski commentedon Mar 11, 2015
@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
roadmaptasks.sandstrom commentedon Mar 15, 2015
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
steelbrain commentedon Mar 16, 2015
-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,mixedorMap<string,string.Auto-Complete-Plus provides a label attribute that serves this purpose grealy.
sandstrom commentedon Mar 16, 2015
@steelbrain I'm thinking of an optional, opt-in, mode. You wouldn't be forced to use it.
benogle commentedon Mar 16, 2015
I think this should be a separate package. For the people who want this behavior, they can disable the default, and install an
inline-autocompletepackage.zslabs commentedon Apr 8, 2015
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:
Routeit 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
benogle commentedon Apr 8, 2015
@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.
benogle commentedon Apr 8, 2015
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!