max397574 / care.nvim

care.nvim - Completion And Recommendation Engine for Neovim - WIP
https://max397574.github.io/care.nvim/
GNU General Public License v3.0
95 stars 5 forks source link

bug: care scrolls through menu items slowly and the rendering of menu items are extremely delayed on certain LSPs. #112

Open mj59487 opened 1 day ago

mj59487 commented 1 day ago

Prerequisites

Neovim Version

NVIM v0.11.0-dev-1010+g86832dcd1

care.nvim setup

require('care').setup {
        snippet_expansion = function(snippet_body)
          vim.snippet.expand(snippet_body)
        end,
      }

      -- Mappings
      vim.keymap.set('i', '<c-n>', function()
        vim.snippet.jump(1)
      end)
      vim.keymap.set('i', '<c-p>', function()
        vim.snippet.jump(-1)
      end)
      vim.keymap.set('i', '<c-space>', function()
        require('care').api.complete()
      end)

      vim.keymap.set('i', '<tab>', '<Plug>(CareConfirm)')
      vim.keymap.set('i', '<c-e>', '<Plug>(CareClose)')
      vim.keymap.set('i', '<c-j>', '<Plug>(CareSelectNext)')
      vim.keymap.set('i', '<c-k>', '<Plug>(CareSelectPrev)')

Actual behavior

image

Hello,

(Optional Information) I have been using care.nvim for approximately two weeks and have encountered several minor issues, most of which have been resolved in subsequent updates. I have not previously reported these issues, as I primarily use Codeberg for managing repositories, and this is my first GitHub account. I created this account to address this specific issue, as it appears no one has reported it yet.

Issue: There is a significant performance issue with the completion menu provided by care.nvim when used with certain LSPs. In some cases, care.nvim operates noticeably slower, with significant delays compared to nvim-cmp by hrsh7th. Specifically, the scrolling behavior in the completion menu is markedly slower. My setup is pretty decent and I'm pretty sure there is no issue with the specs of my computer. Scrolling through the menu items is noticeably delayed, often by approximately 100ms or more. This issue is particularly pronounced with certain LSPs, such as cssls, html, clangd, rust-analyzer, gopls, and pyright. In contrast, when using lua_ls, the performance issue is less noticeable, but the problem persists with the aforementioned LSPs.

Expected behavior

The scrollback for the menu items should be smooth/fair and there really shouldn't be any kind of delay when switching between different items.

Healthcheck

==============================================================================
care:                                           require("care.health").check()

care.nvim ~
- Checking configuration...
- Format entry function:
- Format entry function returns correct value
- Aligments:
- All alignments are correct
- 
- Checking dependencies...
- Dependency 'fzy' found

Steps to reproduce

Steps to reproduce:

  1. Initialize one of the following LSPs: cssls, html, clangd, rust-analyzer, gopls, or pyright.
  2. Write code that triggers autocompletion suggestions.
  3. Scroll through the completion menu using the appropriate API functions.
  4. To evaluate the delay in loading menu items, test with languages such as JavaScript or Go.

Log

No response

Other information

No response

Minimal config

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

require("lazy.minit").repro({
    spec = {
        {
            "max397574/care.nvim",
            config = function()
                require("care").setup({})
                vim.keymap.set("i", "<c-n>", function()
                    vim.snippet.jump(1)
                end)
                vim.keymap.set("i", "<c-p>", function()
                    vim.snippet.jump(-1)
                end)
                vim.keymap.set("i", "<c-space>", function()
                    require("care").api.complete()
                end)

                vim.keymap.set("i", "<tab>", "<Plug>(CareConfirm)")
                vim.keymap.set("i", "<c-e>", "<Plug>(CareClose)")
                vim.keymap.set("i", "<c-j>", "<Plug>(CareSelectNext)")
                vim.keymap.set("i", "<c-k>", "<Plug>(CareSelectPrev)")
            end,
        },
    },
})
max397574 commented 1 day ago

I just pushed an update which likely should bring some performance improvements could you test again?

for me things are working really smoothly even when e.g. using tailwindcss which provides a huge amount of items

mj59487 commented 1 day ago

Greetings, max397574, thank you for responding back to my issue.

I have tested out this new update and unfortunately, I am sorry to say that the bug wasn't fixed with the new update.

max397574 commented 11 hours ago

I think this issue will only be fixed when I rewrite more things to be async this will likely be still a few weeks away

mj59487 commented 10 hours ago

Hello, max397574. Thank you for your reply.