echasnovski / mini.nvim

Library of 40+ independent Lua modules improving overall Neovim (version 0.8 and higher) experience with minimal effort
MIT License
4.47k stars 175 forks source link

Completion performance regression #904

Closed KAAtheWiseGit closed 1 month ago

KAAtheWiseGit commented 1 month ago

Contributing guidelines

Module(s)

mini.completion

Description

Yesterday I've upgraded my distribution, which included updating Neovim from 0.9.4 to 0.10.0. This seems to have caused an issue with the Mini completions. Now, wherever I type, there is subtle lagging going on, with the cursor jumping from where it should be to the end of the -- INSERT -- note and back. It does so very rapidly, causing flashing and typing latency.

Neovim version

0.10.0

Steps to reproduce

  1. nvim -nu minimal.lua

    local package_path = vim.fn.stdpath("data") .. "/site"
    local mini_path = package_path .. "/pack/deps/start/mini.nvim"
    if not vim.loop.fs_stat(mini_path) then
        vim.cmd("echo \"Installing `mini.nvim`\" | redraw")
        local clone_cmd = {
            "git", "clone", "--filter=blob:none",
            "--branch", "stable",
            "https://github.com/echasnovski/mini.nvim", mini_path
        }
        vim.fn.system(clone_cmd)
        vim.cmd("packadd mini.nvim | helptags ALL")
    end
    
    require("mini.deps").setup { path = { package = package_path } }
    local add, now, later = MiniDeps.add, MiniDeps.now, MiniDeps.later
    
    now(function()
        local completion = require("mini.completion")
        completion.setup({
            fallback_action = nil,
        })
    end)
  2. Start typing. The cursor will flicker.

Expected behavior

No response

Actual behavior

I tried recording it with asciinema. Locally the flickering is present, but when I upload the cursor morphs into the block one and the flickering is no longer visible.

echasnovski commented 1 month ago

Thanks for the issue!

Do you use GUI (like Neovide)? Because I can not reproduce this in plain TUI.

Also, I'd recommend disabling that mode messages (like '--INSERT--' ) as it looks not needed with mode indicator in statusline. Could you try adding vim.o.showmode = false to the config and see if this fixes the issue?

KAAtheWiseGit commented 1 month ago

@echasnovski nope, plain Neovim TUI. It's a weird bug, I honestly don't have high hopes of tracking it down. Since there was a full system upgrade, it could've been the terminal, etc.

Oh, scratch that, disabling the mode message fixed the flickering! The latency part is weird, though. I have a feeling that it's still slower, but I can't objectively measure it. So, it might all be just in my head.

UPD: nope, I did a few more checks: the latency is gone too! Thanks a lot for help!

echasnovski commented 1 month ago

Ok, closing then. if there is a reliable reproducible example with vim.o.showmode = true I might look into it, but I'd go as a general suggestion to disable 'showmode' ('mini.basics' already does that).