* idk how good this idea is * this could be working but i still cant figure out how to run it * ignore tags that mini.doc gens, but why? * chore(taskfile): force exiting after tests because i got infinit ci * chore(ci): add more nvim versions to run on * chore: update taskfile * feat: add docs generator * docs: its only begining * refactor: update docgen script * docs: write some more * docs(config): update * docs: update readme * language * hope it would work * what about that? * maybe this would work? * update md * upd * WHY DOESNT IT WORKING * idk by but 0.9.3 just fails the ci, so i deleted it from suite * again update, why does markdown not work in embeded html * maybe it can help? * upd * again update * kinda fix * fix: formatting * again some updating * some readme updating * fix, this shouldnt be in repo * i finnaly undertood how to fix this fking skill issue * fix(struct_tags): typo * refactor(docs): change the order in generated file * docs: install deps * refactor(scripts): rename doc-gen script * docs(impl): write docs * docs(dap): add doc * stylua . * docs(struct_tags): add doc * docs(gotests): add docs * docs(iferr): add docs * docs(comment): add doc * update CONTRIBUTING.md * docs(README): talk about `develop` branch * docs: update README.md
24 lines
715 B
Lua
24 lines
715 B
Lua
---@toc_entry Iferr
|
|
---@tag gopher.nvim-iferr
|
|
---@text if you're using `iferr` tool, this module provides a way to automatically insert `if err != nil` check.
|
|
---@usage execute `:GoIfErr` near any err variable to insert the check
|
|
|
|
local c = require "gopher.config"
|
|
local iferr = {}
|
|
|
|
-- That's Lua implementation: github.com/koron/iferr
|
|
function iferr.iferr()
|
|
local boff = vim.fn.wordcount().cursor_bytes
|
|
local pos = vim.fn.getcurpos()[2]
|
|
|
|
local data = vim.fn.systemlist((c.commands.iferr .. " -pos " .. boff), vim.fn.bufnr "%")
|
|
if vim.v.shell_error ~= 0 then
|
|
error("iferr failed: " .. data)
|
|
end
|
|
|
|
vim.fn.append(pos, data)
|
|
vim.cmd [[silent normal! j=2j]]
|
|
vim.fn.setpos(".", pos)
|
|
end
|
|
|
|
return iferr
|