feat(comment): add comment on a struct field

This commit is contained in:
Oleksandr Smirnov 2025-09-04 14:36:12 +03:00
parent 3cd45c45a3
commit 9bffa2c212
No known key found for this signature in database
9 changed files with 100 additions and 7 deletions

View file

@ -15,6 +15,11 @@ local comment = {}
---@return string
---@dochide
local function generate(bufnr, line)
local sf_ok, sf_res = pcall(ts.get_struct_field_under_cursor, bufnr)
if sf_ok then
return u.indent(line, sf_res.indent) .. "// " .. sf_res.name .. " "
end
local s_ok, s_res = pcall(ts.get_struct_under_cursor, bufnr)
if s_ok then
return u.indent(line, s_res.indent) .. "// " .. s_res.name .. " "