optimize for go and ts_contex

mine
ray-x 2 years ago
parent e9a40aca40
commit 927c464b70

@ -170,10 +170,11 @@ function M.prepare_for_render(items, opts)
-- let check if there are unmatched "/'
end
if #space + #item.text + #ts_report >= win_width then
if #item.text + #ts_report > win_width then
trace('exceeding', #item.text, #ts_report, win_width)
if #item.text + #ts_report >= win_width then
space = ' '
local len = math.max(win_width - #item.text - 4, 16)
trace('exceeding', #item.text, #ts_report, win_width, len)
ts_report = ts_report:sub(1, len)
else
local remain = win_width - #item.text - #ts_report

@ -148,7 +148,10 @@ local transform_line = function(line)
line = line:gsub("function", "")
line = line:gsub("func%w*%s+", "")
if _NgConfigValues.treesitter_analysis_condense then
line = line:gsub("%([%a,%s]+%)", "()")
line = line:gsub("%([%a%.,%s%[%]%*]+%)", "()")
-- this is for multi return
line = line:gsub("%([%a%.,%s%[%]%*]+%)", "()")
line = line:gsub("%(%)%s*%(%)", "()")
end
return line
end
@ -158,9 +161,6 @@ function M.ref_context(opts)
return
end
local options = opts or {}
-- if type(opts) == "number" then
-- options = { indicator_size = opts }
-- end
local bufnr = options.bufnr or 0
local pos = options.pos

Loading…
Cancel
Save