refactor: move thing out to utils

This commit is contained in:
Oleksandr Smirnov 2025-03-22 23:00:14 +02:00
parent 0c0584edbd
commit 74d7afcc01
No known key found for this signature in database
3 changed files with 15 additions and 10 deletions

View file

@ -30,4 +30,11 @@ function utils.remove_empty_lines(t)
return res
end
---@param s string
---@return string
function utils.trimend(s)
local r, _ = string.gsub(s, "%s+$", "")
return r
end
return utils

View file

@ -33,6 +33,7 @@
local ts = require "gopher._utils.ts"
local r = require "gopher._utils.runner"
local c = require "gopher.config"
local u = require "gopher._utils"
local log = require "gopher._utils.log"
local struct_tags = {}
@ -77,7 +78,7 @@ local function handle_tags(fpath, bufnr, user_args)
end
for i, v in ipairs(res["lines"]) do
res["lines"][i] = string.gsub(v, "%s+$", "")
res["lines"][i] = u.trimend(v)
end
vim.api.nvim_buf_set_lines(