Summary:
Right now we have two ways to access the public api we have `require('ivy')`
and `vim.ivy. Each way has a different api that will cause some confusion.
Now both apis are the same so anyone that wants to integrate with ivy can do so
without having to figure out what one they need to use.
Test Plan:
The unit tests cover most of the work, I have also been using this locally for
quite some time now with now issues.
Now when you paste and you are in an ivy buffer the paste will be added
to the prompt not into the completion window. You can use your usual
paste key binding I.E. <SHIFT>+<INSERT> <CTRL>+<SHIFT>+<V>
Ref: #11
This was causing an issue an invalid regex. Now we are escapeing the
text to make it a valid regex.
There is also a small improvement where we no longer try and highlight
matched words if the "text" is empty.
Ref: #26
Now you can open the currently selected item in a vertical split or a
horizontal split. The completion callback must support the current
actions.
There is also a bit of testing in here. The vim mock has been refactored
and split out so we can use it multiple tests.
When you complete a completion the completion window is no longer
activated after the callback is run. This was causing issues with the
incorrect window being active after the completion.
This will lead the way for more actions other then edit, that will be
comming soon.
Fixes-issue: #8
The API for `window.set_items` took to many variable types. It would
take a table in multiple different formats and a string. Now it will
only take a table in a single format and a string. It will convert the
string into the table format by splitting it on new lines.
The table format is an array of tables that must have a `content` key
that will be the text that is displayed in the completion window. The
table can have any other data that is ignored.
```lua
local items = {
{ content = "Item one" },
{ content = "Item two" }
}
```
The `set_items` function will only display the `content` key in the
completion window, it will not do any sorting or filtering, that must be
done before passing the data to the `set_items` function.
This will allow you to get the buffer the user was on when they invoked
an ivy command. This buffer is called the `origin` and you can access it
with `vim.ivy.origin()`.
Large projects can take a long time for the initial scan. This adds some
loading text until the initial selection has completed.
This will also now schedule the work to collect and sort the candidates
to ensure the UI is rendered before with work begins and creates a
hanging user experience.