This commit is contained in:
hrsh7th
2021-08-17 00:53:38 +09:00
parent e4deb0142a
commit d56bf1d506
5 changed files with 49 additions and 28 deletions

View File

@@ -74,8 +74,8 @@ menu.update = check.wrap(function(self, ctx, sources)
-- check the source triggered by character
local has_triggered_by_symbol_source = false
for _, s in ipairs(sources) do
if s:has_items() then
if #s:get_entries(ctx) > 0 and s.is_triggered_by_symbol then
if #s:get_entries(ctx) > 0 then
if s.is_triggered_by_symbol then
has_triggered_by_symbol_source = true
break
end
@@ -85,7 +85,7 @@ menu.update = check.wrap(function(self, ctx, sources)
-- create filtered entries.
local offset = ctx.cursor.col
for i, s in ipairs(sources) do
if s:has_items() and s.offset <= offset then
if s.offset <= offset then
if not has_triggered_by_symbol_source or s.is_triggered_by_symbol then
-- source order priority bonus.
local priority = (#sources - (i - 1)) * config.get().sorting.priority_weight