Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 tasks done
mj59487 opened this issue Oct 21, 2024 · 13 comments · Fixed by #135
Closed
2 tasks done

Comments

@mj59487
Copy link

mj59487 commented Oct 21, 2024

Prerequisites

  • I am using the latest stable or nightly neovim version
  • I am using the latest version of the plugin

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
Copy link
Owner

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
Copy link
Author

mj59487 commented Oct 21, 2024

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
Copy link
Owner

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
Copy link
Author

mj59487 commented Oct 22, 2024

Hello, max397574.
Thank you for your reply.

@max397574
Copy link
Owner

will be tracked in #122

@max397574 max397574 reopened this Nov 9, 2024
max397574 added a commit that referenced this issue Nov 9, 2024
@max397574
Copy link
Owner

@mj59487 could you test this branch? #135

@mj59487
Copy link
Author

mj59487 commented Nov 10, 2024

Greetings, Max.

I appreciate your prompt response. This serves as my comprehensive reply to you:

Screenshot from Sun 10 Nov 2024 07:25:11 PM +06

I have meticulously implemented the newly provided branch designated as 'push-wvlnuyxtuvxn,' and here are the results I have observed:

There was an exceedingly minuscule increase in performance; however, this improvement was accompanied by an exponential proliferation of bugs, which has been profoundly exasperating. I have ceased utilizing Care for approximately four days due to this irksome performance issue. I have never encountered such an anomalous situation with any of the other completion plugins previously. My experience with Care has been nothing short of dismal and unbearably uncomfortable because of this performance issue, along with various other complications. With this new performance branch, there are now additional bugs related to the flickering of documentation and the improper rendering of menus. My repeat setting is configured to a moderate 30, yet Care feels as though it operates at a staggering 50 times slower than nvim-cmp. It is worth noting that I have recently acquired a formidable setup featuring an AMD Ryzen 9 9950X and a highly capable GPU. This level of performance degradation is utterly unexpected and a significant inconvenience to work with.

@max397574
Copy link
Owner

🤔 I can't really explain this
since I made the updates on the branch based of testing on my old mac book air (2015) which has really bad performance
and I'm not getting any issues at all with said branch

@mj59487

This comment was marked as off-topic.

@mj59487 mj59487 closed this as completed Nov 10, 2024
@max397574 max397574 reopened this Nov 10, 2024
@max397574
Copy link
Owner

still leaving this open because I still want to fix them

@max397574
Copy link
Owner

@mj59487 could you share your config (according to your profile likely on codeberg, which is ok for me)

so I could use this to look into this issue

thank you in advance

max397574 added a commit that referenced this issue Nov 10, 2024
@mj59487
Copy link
Author

mj59487 commented Nov 11, 2024

Greetings, max.

My configuration for care.nvim has been given below for better convenience.

      require('care').setup {
        snippet_expansion = function(snippet_body)
          require('luasnip').lsp_expand(snippet_body)
        end,

        sources = {
          cmp_luasnip = {
            enabled = true,
          },
        },

        ui = {
          ghost_text = {
            position = 'inline',
          },

          menu = {
            scrollbar = {
              enabled = false,
            },

            format_entry = function(entry, data)
              local preset_components = require('care.presets.components')
              return {
                preset_components.KindIcon(entry, 'fg'),
                preset_components.Padding(1),
                preset_components.Label(entry, data, false),
                preset_components.Padding(1),
              }
            end,
          },
        },
      }

I have reviewed the recent update concerning the new branch for performance, and I must say that the performance improvements are quite impressive as they got rid off of a lot of extreme performance problem. However, I did notice a minor yet significant delay in key repeat functionality. Additionally, while there is virtually no delay for properties within CSS (Cascading Style Sheets), there remains a slight delay that is somewhat unfortunate.

@mj59487
Copy link
Author

mj59487 commented Nov 14, 2024

Greetings, author.

I feel unfortunate to state that the problem still endures often on similar cases.

Sincerely, matt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants