Add the ability to specify source priority manually
This commit is contained in:
@@ -89,7 +89,7 @@ menu.update = function(self, ctx, sources)
|
||||
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
|
||||
local priority = s:get_config().priority or ((#sources - (i - 1)) * config.get().sorting.priority_weight)
|
||||
|
||||
for _, e in ipairs(s:get_entries(ctx)) do
|
||||
e.score = e.score + priority
|
||||
|
||||
@@ -100,6 +100,7 @@ cmp.PreselectMode.None = 'none'
|
||||
---@class cmp.SourceConfig
|
||||
---@field public name string
|
||||
---@field public opts table
|
||||
---@field public priority number|nil
|
||||
---@field public keyword_pattern string
|
||||
---@field public keyword_length number
|
||||
---@field public max_item_count number
|
||||
|
||||
Reference in New Issue
Block a user