Skip to content

[Feature Request] Option to Mark Specific LSPs as Manual-Trigger Only #80

@naquad

Description

@naquad

These days, many AI assistants are integrated as LSP clients. The problem is that when typing quickly, their responses are often slow, causing cmp to lag while waiting for them to respond, despite the asynchronous structure of the cmp.

I suggest adding an option to cmp-nvim-lsp that allows specific LSPs to be set as manual-trigger only—similar to how Minuet AI handles it.

Something akin to:

   -- ...
    sources = cmp.config.sources({
      { name = 'nvim_lsp', max_item_count = 10, manual_only = { 'tabby_ml' } },
      -- ...
    })

Otherwise, one has to do terrible things:

diff --git a/lua/cmp_nvim_lsp/source.lua b/lua/cmp_nvim_lsp/source.lua
index 43ccac1..d20a8ea 100644
--- a/lua/cmp_nvim_lsp/source.lua
+++ b/lua/cmp_nvim_lsp/source.lua
@@ -64,6 +64,11 @@ end
 ---@param params cmp.SourceCompletionApiParams
 ---@param callback function
 source.complete = function(self, params, callback)
+  if self.client.name == 'tabby_ml' and params.context.option.reason ~= 'manual' then
+    callback()
+    return
+  end
+
   local lsp_params = vim.lsp.util.make_position_params(0, self.client.offset_encoding)
   lsp_params.context = {}
   lsp_params.context.triggerKind = params.completion_context.triggerKind

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions