refactor of public plugin's api (#37)

* refactor: move all plugin functionality to init.lua

* fix(commands): now it uses correct module paths

* refactor(config): change way how it handles options

* refactor(gotests): use correct config, change way how deps required, fix some typos

* fix(healthchecker): use correct config

* refactor(iferr): change api

* refactor(impl): change api

* refactor(installer): change api

* refactor(struct_tags): change way of importting deps

* refactor(struct_tags): rename M to struct_tags

* run stylua

* refactor(dap): make it all in one file, and make some refactoring

* refactor(_utils): change way how it organizes

* fix: use new _utils api

* refactor(_utils.health): reorganize module

* refactor(_utils.ts): some renameing, moving requires lines

* run stylua
This commit is contained in:
Smirnov Oleksandr 2023-07-19 23:38:23 +03:00 committed by GitHub
parent 94250bb08a
commit 26b41bf68c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 359 additions and 341 deletions

View file

@ -1,16 +1,18 @@
---Add iferr declaration
---That's Lua of vimscript implementation of:
---github.com/koron/iferr
return function()
local c = require("gopher.config").config.commands
local u = require "gopher._utils"
local c = require("gopher.config").commands
local u = require "gopher._utils"
local iferr = {}
-- That's Lua of vimscript implementation of: github.com/koron/iferr
iferr.iferr = function()
local boff = vim.fn.wordcount().cursor_bytes
local cmd = (c.iferr .. " -pos " .. boff)
local data = vim.fn.systemlist(cmd, vim.fn.bufnr "%")
if vim.v.shell_error ~= 0 then
u.notify("command " .. cmd .. " exited with code " .. vim.v.shell_error, "error")
u.deferred_notify(
"command " .. cmd .. " exited with code " .. vim.v.shell_error,
vim.log.levels.ERROR
)
return
end
@ -19,3 +21,5 @@ return function()
vim.cmd [[silent normal! j=2j]]
vim.fn.setpos(".", pos)
end
return iferr