mfussenegger / nvim-dap

Debug Adapter Protocol client implementation for Neovim
GNU General Public License v3.0
5.65k stars 205 forks source link

[Feature Request] Trigger autocompletion for every character #1335

Closed igorlfs closed 1 month ago

igorlfs commented 2 months ago

Problem Statement

Hello! I'm trying to incorporate nvim-dap's built-in autocompletion into my workflow. The documentation states that

Completion will then trigger automatically on any of the completion trigger
characters reported by the debug adapter, or on `.` if none are reported.

Using the debugpy adapter, it seems to fall back to trigger completion on .. But IMO, a more natural approach would be to use every character instead.

Possible Solutions

An option to control the fallback characters for completion, which would allow using every character.

Considered Alternatives

There's a nvim-cmp source for dap, which I was trying to migrate from.

mfussenegger commented 2 months ago

A workaround could be to edit the completionTriggerCharacters of the session's capabilities.

E.g.:

  local dap = require("dap")
  dap.listeners.after.event_initialized["compl-triggers"] = function(session)
    local capabilities = session.capabilities
    if capabilities then
      capabilities.completionTriggerCharacters = {"a", "e", "i", "o", "u", "."}
    end
  end

Or you could setup your own completion trigger similar to :help compl-autocomplete

mfussenegger commented 1 month ago

I might change my mind around this, but for now I have no plans to extend this and given that there are workarounds I'm closing this