From f1647f7fd97ac7129e1cb8a1ed242ae326f25d6e Mon Sep 17 00:00:00 2001 From: Liam Dyer Date: Tue, 5 Nov 2024 11:04:35 -0500 Subject: [PATCH] fix: override typing and module --- .../cmp/sources/lib/provider/override.lua | 4 +--- lua/blink/cmp/sources/lib/types.lua | 20 +++++++++---------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/lua/blink/cmp/sources/lib/provider/override.lua b/lua/blink/cmp/sources/lib/provider/override.lua index 98e172d2..96e8eddd 100644 --- a/lua/blink/cmp/sources/lib/provider/override.lua +++ b/lua/blink/cmp/sources/lib/provider/override.lua @@ -8,9 +8,7 @@ function override.new(module, override_config) return setmetatable({}, { __index = function(_, key) - if override_config[key] ~= nil then - return function(self, ...) return override_config[key](self.module, ...) end - end + if override_config[key] ~= nil then return function(_, ...) return override_config[key](module, ...) end end return module[key] end, }) diff --git a/lua/blink/cmp/sources/lib/types.lua b/lua/blink/cmp/sources/lib/types.lua index 2e92b528..3421cefe 100644 --- a/lua/blink/cmp/sources/lib/types.lua +++ b/lua/blink/cmp/sources/lib/types.lua @@ -11,22 +11,22 @@ --- @class blink.cmp.Source --- @field new fun(config: blink.cmp.SourceProviderConfig): blink.cmp.Source --- @field enabled? fun(self: blink.cmp.Source, context: blink.cmp.Context): boolean ---- @field get_trigger_characters? (fun(self: blink.cmp.Source): string[]) | nil ---- @field get_completions? fun(self: blink.cmp.Source, context: blink.cmp.Context, callback: fun(response: blink.cmp.CompletionResponse | nil)): (fun(): nil) | nil ---- @field filter_completions? (fun(self: blink.cmp.Source, response: blink.cmp.CompletionResponse): blink.cmp.CompletionItem[]) | nil ---- @field should_show_completions? (fun(self: blink.cmp.Source, context: blink.cmp.Context, response: blink.cmp.CompletionResponse): boolean) | nil ---- @field resolve? (fun(self: blink.cmp.Source, item: blink.cmp.CompletionItem, callback: fun(resolved_item: lsp.CompletionItem | nil)): ((fun(): nil) | nil)) | nil +--- @field get_trigger_characters? fun(self: blink.cmp.Source): string[] +--- @field get_completions? fun(self: blink.cmp.Source, context: blink.cmp.Context, callback: fun(response?: blink.cmp.CompletionResponse)): (fun(): nil) | nil +--- @field filter_completions? fun(self: blink.cmp.Source, response: blink.cmp.CompletionResponse): blink.cmp.CompletionItem[] +--- @field should_show_completions? fun(self: blink.cmp.Source, context: blink.cmp.Context, response: blink.cmp.CompletionResponse): boolean +--- @field resolve? fun(self: blink.cmp.Source, item: blink.cmp.CompletionItem, callback: fun(resolved_item?: lsp.CompletionItem)): ((fun(): nil) | nil) --- @field get_signature_help_trigger_characters? fun(self: blink.cmp.Source): string[] --- @field get_signature_help? fun(self: blink.cmp.Source, context: blink.cmp.SignatureHelpContext, callback: fun(signature_help: lsp.SignatureHelp | nil)): (fun(): nil) | nil ---- @field reload? (fun(self: blink.cmp.Source): nil) | nil +--- @field reload? fun(self: blink.cmp.Source): nil --- @class blink.cmp.SourceOverride --- @field enabled? fun(self: blink.cmp.Source, context: blink.cmp.Context): boolean --- @field get_trigger_characters? fun(self: blink.cmp.Source): string[] ---- @field get_completions? fun(self: blink.cmp.Source, context: blink.cmp.Context): blink.cmp.Task +--- @field get_completions? fun(self: blink.cmp.Source, context: blink.cmp.Context, callback: fun(response: blink.cmp.CompletionResponse | nil)): (fun(): nil) | nil --- @field filter_completions? fun(self: blink.cmp.Source, response: blink.cmp.CompletionResponse): blink.cmp.CompletionItem[] --- @field should_show_completions? fun(self: blink.cmp.Source, context: blink.cmp.Context, response: blink.cmp.CompletionResponse): boolean ---- @field resolve? fun(self: blink.cmp.Source, item: blink.cmp.CompletionItem): blink.cmp.Task +--- @field resolve? fun(self: blink.cmp.Source, item: blink.cmp.CompletionItem, callback: fun(resolved_item: lsp.CompletionItem | nil)): ((fun(): nil) | nil) --- @field get_signature_help_trigger_characters? fun(self: blink.cmp.Source): string[] ---- @field get_signature_help? fun(self: blink.cmp.Source, context: blink.cmp.SignatureHelpContext): blink.cmp.Task ---- @field reload? (fun(self: blink.cmp.Source): nil) | nil +--- @field get_signature_help? fun(self: blink.cmp.Source, context: blink.cmp.SignatureHelpContext, callback: fun(signature_help: lsp.SignatureHelp | nil)): (fun(): nil) | nil +--- @field reload? fun(self: blink.cmp.Source): nil