autocomplete-plus
autocomplete-plus copied to clipboard
Autocomplete in input fields / mini editors
can autocomplete be used for the regular input fields created using space pen.
It only triggers for editors currently. Not for mini editors. And not for input fields that are not editors.
What about for embedded editors?
For example, the editor seen here:
Which is an atom-text-editor element described as:
+1, I'm working on a console component for Atom and would really like to see this working.
Does this seem like a reasonable project for someone new to the codebase? I don't mind digging around and having a go at it if I get the chance, any tips are appreciated of course.
Also happy to poke around and try to get this working. Any suggestions on where to start looking?
it's been awhile since I've taken a look but it's worth noting that many of the handy text editor features are missing -- it doesn't modify the tab, autoclose brackets, put highlighted things in quotes, etc.. It just seems like there is some simple scoping issue. It's weird that syntax highlighting works when these other things don't. Guess is because that's set at a lower level. Maybe here by looking at params passed in? That's a pretty wild guess though.
Interesting, was your "embedded editor" above an actual instance of TextEditor
?
What I'm trying to do is create a new atom-text-editor
element. That isn't enough to get all the goodies you mentioned above, but I'm hoping creating an actual TextEditor
will make those things work
Any suggestions on where to start looking?
Currently, this package only watches editors that are a pane item. See this line. Mini editors are just text editors, but there is no clean way to observe all of them. A couple things that would need to happen to make this viable
- Come up with a nice way to observe all mini editors for this package
- Think through how providers interact with mini editors. Likely there wont be much overlap in the providers between the code editors in pane items and mini editors. So we will need to add something that allows a provider to target mini editors, editors used in packages, and pane item editors.
- Write special providers for mini editors that target specific contexts
When @benogle posted last, the code was indeed using atom.workspace.observeActivePaneItem()
to subscribe to editors. Nowadays, it appears to use atom.textEditors.observe()
to subscribe. If I have my own instance of a TextEditor
, it seems like I can register it via atom.textEditors.add()
and autocomplete-plus
will find out about it. So three questions:
- Is using
atom.textEditors.add()
the right way to address this bug? - If so, can we publicly document it? I don't see anything about
TextEditorRegistry
in today's docs: https://atom.io/docs/api/v1.12.7/. - Finally, if
atom.textEditors.add()
is the way to go (or even if it isn't), can we make it idempotent? If you look at how it works today (https://github.com/atom/atom/blob/v1.13.0-beta8/src/text-editor-registry.js#L105), it appears that if the same editor is passed toadd()
twice, then another'did-add-editor'
event will be emitted for the same editor. (Ideally, the existingDisposable
would probably be returned, too.)
/cc @as-cii @joefitzgerald
I still do not understand, is there a full example of how to do this, someone can tell?