Skip to content

Commit

Permalink
fix: override typing and module
Browse files Browse the repository at this point in the history
  • Loading branch information
Saghen committed Nov 5, 2024
1 parent 338d2a6 commit f1647f7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
4 changes: 1 addition & 3 deletions lua/blink/cmp/sources/lib/provider/override.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
Expand Down
20 changes: 10 additions & 10 deletions lua/blink/cmp/sources/lib/types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f1647f7

Please sign in to comment.