docs(iferr): add docs

This commit is contained in:
Smirnov Oleksandr 2024-04-02 17:44:46 +03:00
parent 3f07f03117
commit beed143e64
3 changed files with 16 additions and 1 deletions

View file

@ -14,6 +14,7 @@ Table of Contents
Modifty struct tags................................|gopher.nvim-struct-tags|
Auto implementation of interface methods..................|gopher.nvim-impl|
Generating unit tests boilerplate......................|gopher.nvim-gotests|
Iferr....................................................|gopher.nvim-iferr|
Setup `nvim-dap` for Go......................................|gopher.nvim-dap|
------------------------------------------------------------------------------
@ -191,6 +192,14 @@ you can do it with:
if you choose to install `gotests` within neovim, i recommend adding it to your `build` section in your |lazy.nvim|
==============================================================================
------------------------------------------------------------------------------
*gopher.nvim-iferr*
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
==============================================================================
------------------------------------------------------------------------------
*gopher.nvim-dap*

View file

@ -1,7 +1,12 @@
---@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 of vimscript implementation of: github.com/koron/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]

View file

@ -13,6 +13,7 @@ local files = {
"lua/gopher/struct_tags.lua",
"lua/gopher/impl.lua",
"lua/gopher/gotests.lua",
"lua/gopher/iferr.lua",
"lua/gopher/dap.lua",
}