Skip to content

Signature doesn't show up on a JS file right after the autocompletion is accepted #1685

Open
@canova

Description

@canova

Make sure you have done the following

  • Updated to the latest version of blink.cmp
  • Searched for existing issues and documentation (try <C-k> on https://cmp.saghen.dev)

Bug Description

I just migrated to blink.nvim, thanks for the project, it's great!

I was trying the signature feature and encountered and interesting behavior on JS files. When I'm on a lua file, the signature shows up correctly after I accept and autocomplete suggestion. But when I'm on a JS file (with the ts_ls lsp), the signature help window doesn't appear directly when I accept an autocomplete suggestion.

I'm not so sure why it's happening. But it seems like it's starting to work either:

  1. When I type a trigger character like ,.
  2. When I delete the parentheses and type them back again.

I also captured a screen recording to show the current behavior I'm seeing. This is a simple test.js file in an empty directory that I added for this test:

blink-signature-issue.mov

As you can see, on both cases, when I accept the suggestion, it doesn't show me anything.

I did some printf debugging, and noticed that in Lua, we are triggering this through this if branch:

elseif event == 'CursorMoved' and trigger.context ~= nil then
trigger.show()

But in JS, we are not entering inside of this if branch because trigger.context is nil. I'm not so sure yet why this is the case though. I'm not familiar with the code.

If you have any pointers into how to debug this issue, I'm happy to help.

Also, here's a repro.lua file for this one:

-- Run with `nvim -u repro.lua`

vim.env.LAZY_STDPATH = '.repro'
load(vim.fn.system('curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua'))()

---@diagnostic disable-next-line: missing-fields
require('lazy.minit').repro({
  spec = {
    {
      'saghen/blink.cmp',
      -- please test on `main` if possible
      -- otherwise, remove this line and set `version = '*'`
      build = 'cargo build --release',
      opts = {
        signature = { enabled = true },
      },
    },
    {
      'neovim/nvim-lspconfig',
      opts = {
        servers = {
          ts_ls = {},
        },
      },
      config = function(_, opts)
        local lspconfig = require('lspconfig')
        for server, config in pairs(opts.servers) do
          -- passing config.capabilities to blink.cmp merges with the capabilities in your
          -- `opts[server].capabilities, if you've defined it
          config.capabilities = require('blink.cmp').get_lsp_capabilities()
          lspconfig[server].setup(config)
        end
      end,
    },
  },
})

typescript language server needs to be installed for this. You can do it with npm install -g typescript typescript-language-server.

Relevant configuration

signature = { enabled = true }

neovim version

v0.11.0

blink.cmp version

Current main branch, f2e4f6a

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsignatureRelated to the signature help

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions