Compare commits

...

2 commits

Author SHA1 Message Date
ded926a4a6 chore: make public api consistent
All checks were successful
CI / Luacheck (pull_request) Successful in 20s
CI / StyLua (pull_request) Successful in 12s
CI / Cargo Format (pull_request) Successful in 18s
CI / Build and test (pull_request) Successful in 2m2s
Conventional Tools Commitlint / Commitlint (pull_request) Successful in 4s
CI / Luacheck (push) Successful in 22s
CI / StyLua (push) Successful in 12s
CI / Cargo Format (push) Successful in 18s
CI / Build and test (push) Successful in 1m52s
Conventional Tools Commitlint / Commitlint (push) Successful in 5s
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.
2024-09-03 19:34:17 +01:00
f910955ad1 ci: run stylua via npx rather than via action
All checks were successful
CI / Luacheck (push) Successful in 22s
CI / StyLua (push) Successful in 12s
CI / Cargo Format (push) Successful in 19s
CI / Build and test (push) Successful in 1m50s
Conventional Tools Commitlint / Commitlint (push) Successful in 5s
Summary:

This is so we don't need the GITHUB_TOKEN that can not be added in forgejo. I
am giving it a go and the `GITHUB_` prefix is reserved for secrets. There are
also issues with the action in a forgejo environment due to the API not
resolving to github.

This now should work on both platforms. So we can maintain github compatibility
for any pull requests that may come that way.

Test Plan:

Run the CI on github and forgejo, this will need to be a manual process to
validate this works.

Pull Request: #2
2024-09-03 19:20:09 +01:00
4 changed files with 21 additions and 9 deletions

View file

@ -29,11 +29,7 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Run stylua - name: Run stylua
uses: JohnnyMorganz/stylua-action@v4.0.0 run: npx @johnnymorganz/stylua-bin --check .
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest
args: --check .
cargo-format: cargo-format:
name: Cargo Format name: Cargo Format

View file

@ -3,7 +3,6 @@ local prompt = require "ivy.prompt"
local utils = require "ivy.utils" local utils = require "ivy.utils"
local controller = {} local controller = {}
controller.action = utils.actions
controller.items = nil controller.items = nil
controller.callback = nil controller.callback = nil
@ -56,7 +55,7 @@ end
controller.checkpoint = function() controller.checkpoint = function()
vim.api.nvim_set_current_win(window.origin) vim.api.nvim_set_current_win(window.origin)
controller.callback(window.get_current_selection(), controller.action.CHECKPOINT) controller.callback(window.get_current_selection(), utils.actions.CHECKPOINT)
vim.api.nvim_set_current_win(window.window) vim.api.nvim_set_current_win(window.window)
end end

View file

@ -1,11 +1,28 @@
local controller = require "ivy.controller" local controller = require "ivy.controller"
local libivy = require "ivy.libivy"
local config = require "ivy.config" local config = require "ivy.config"
local utils = require "ivy.utils"
local register_backend = require "ivy.register_backend" local register_backend = require "ivy.register_backend"
local ivy = {} local ivy = {}
ivy.action = utils.actions
ivy.utils = utils
ivy.match = libivy.ivy_match
ivy.run = controller.run ivy.run = controller.run
ivy.register_backend = register_backend ivy.register_backend = register_backend
ivy.checkpoint = controller.checkpoint
ivy.paste = controller.paste
ivy.complete = controller.complete
ivy.destroy = controller.destroy
ivy.input = controller.input
ivy.next = controller.next
ivy.previous = controller.previous
ivy.search = controller.search
-- Private variable to check if ivy has been setup, this is to prevent multiple -- Private variable to check if ivy has been setup, this is to prevent multiple
-- setups of ivy. This is only exposed for testing purposes. -- setups of ivy. This is only exposed for testing purposes.
---@private ---@private

View file

@ -1,9 +1,9 @@
local controller = require "ivy.controller" local api = require "ivy"
-- Put the controller in to the vim global so we can access it in mappings -- Put the controller in to the vim global so we can access it in mappings
-- better without requires. You can call controller commands like `vim.ivy.xxx`. -- better without requires. You can call controller commands like `vim.ivy.xxx`.
-- luacheck: ignore -- luacheck: ignore
vim.ivy = controller vim.ivy = api
vim.paste = (function(overridden) vim.paste = (function(overridden)
return function(lines, phase) return function(lines, phase)