Skip to content
This repository has been archived by the owner on Aug 24, 2018. It is now read-only.

An API for other Packages to use this. #10

Closed
JAStanton opened this issue Mar 1, 2014 · 14 comments
Closed

An API for other Packages to use this. #10

JAStanton opened this issue Mar 1, 2014 · 14 comments

Comments

@JAStanton
Copy link

It would be great if there was an API on this package that would allow me to spin up an instance of the AutoComplete whenever / wherever I wanted.

@JAStanton
Copy link
Author

Or allow us to extend it by doing something like

{Autocomplete} = require 'atom'

which doesn't seem to work

@kevinsawicki
Copy link
Contributor

So for your use case, you want to just open the autocomplete view in the current editor populated with a list of words that your package would be providing?

@JAStanton
Copy link
Author

Correct. And I would want callbacks for selected item, that kind of thing.

@JAStanton
Copy link
Author

A discussion on the matter: http://discuss.atom.io/t/depending-on-other-packages/2360/4

@kevinsawicki
Copy link
Contributor

Okay, so would you still want the default behavior where the selected word is inserted into the editor or do you want to take that over in your package and do something custom when a word is selected?

@JAStanton
Copy link
Author

Probably not. if inside a doc block you type @ I want it to trigger a list. if you select @author it should insert a snippet '@author ${1:[author]}' whereby when you press tab it will select the first argument. That kind of thing.

I already have the author snippet in my snippets:

  'author':
    'prefix': 'author'
    'body': '@author ${1:[author]}'

@amccloud
Copy link

amccloud commented Mar 2, 2014

@JAStanton since you're providing the items is https://atom.io/docs/api/v0.64.0/api/classes/SelectListView.html suited for your needs?

@JAStanton
Copy link
Author

@amccloud it almost does but there is a lot of logic inside of AutocompleteView that I would be straight up copying and pasting.
everything in handleEvents, buildWordList (though I would supply my own data source), the setPosition, attach, I mean almost everything looks like what I need I think

@JAStanton
Copy link
Author

I ended up just copying the source of autocomplete class over to my package.

@mattapperson
Copy link

+100000 on this

@saschagehlich
Copy link

I updated my package autocomplete-plus to support third-party suggestion providers. I also added an tutorial on how to create a provider:

https://github.com/saschagehlich/autocomplete-plus/wiki/Tutorial:-Registering-and-creating-a-suggestion-provider

I hope that something like this finds its way into the original autocomplete plugin some day. :)

@joefitzgerald
Copy link

@saschagehlich I think we should definitely upstream the Provider API you guys defined. I'm going to spend some time this weekend putting a PR together against this repo to achieve that.

@joefitzgerald
Copy link

@kevinsawicki
Copy link
Contributor

This package is deprecated and no longer shipped with Atom. If this is still an issue using the autocomplete-plus package, please open up a new issue on that repository, thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants