VonHeikemen / lsp-zero.nvim

A starting point to setup some lsp related features in neovim.
https://lsp-zero.netlify.app/v4.x/
MIT License
3.76k stars 95 forks source link

Sluggish autocomplete/responsiveness even on great PC #228

Closed avvo-na closed 1 year ago

avvo-na commented 1 year ago

Hey! Just wanted to reach out, maybe you would know the answer to this issue. I've been working specifically in react for a bit using this plugin to meld together all of the LSP stuff. However I've noticed a hugeee slowdown working in react files. Autocomplete takes 1-1.5s to show results and just a general feeling of being super bogged down. I also followed your guide to set up mason with null-ls for formatting.

I doubt this is technically related to Lsp-Zero as I suspect its a broader issue.

When in a buffer with a lot of LSP's attached (react) I get constant slowdown:

LSPS ATTACHED:
null-ls
copilot
emmet_ls
tsserver
tailwindcss
PLUGIN CONFIGURATION:
  {
    "VonHeikemen/lsp-zero.nvim",
    branch = "v1.x",
    dependencies = {
      -- LSP
      "neovim/nvim-lspconfig",             -- Required
      "williamboman/mason.nvim",           -- Optional
      "williamboman/mason-lspconfig.nvim", -- Optional
      -- Autocompletion
      "hrsh7th/nvim-cmp",                  -- Required
      "hrsh7th/cmp-nvim-lsp",              -- Required
      "hrsh7th/cmp-buffer",                -- Optional
      "hrsh7th/cmp-path",                  -- Optional
      "saadparwaiz1/cmp_luasnip",          -- Optional
      "hrsh7th/cmp-nvim-lua",              -- Optional
      -- Snippets
      "L3MON4D3/LuaSnip",                  -- Required
      "rafamadriz/friendly-snippets",      -- Optional
      -- Custom
      "jose-elias-alvarez/null-ls.nvim",   -- NULL LS
      "jay-babu/mason-null-ls.nvim",       -- NULL LS + Mason Support
      "glepnir/lspsaga.nvim",              -- Better LSP UI
      "folke/neodev.nvim",                 -- NeoDev LSP
      "mfussenegger/nvim-jdtls",           -- Java LSP
      "windwp/nvim-autopairs",             -- Autopairs
    }
  },

If there is any more info you need from me feel free to let me know!

VonHeikemen commented 1 year ago

I've seen people on twitter complaining about tailwind's LSP. Maybe start there, disable tailwindcss.

avvo-na commented 1 year ago

I've seen people on twitter complaining about tailwind's LSP. Maybe start there, disable tailwindcss.

Yeah, really weird. Tailwindcss LSP was causing massive issues. Thanks for the recommendation!

avvo-na commented 1 year ago

Just thought I would drop a comment in here on what I did to fix it. Turns out Tailwind LSP is really heavy weight and regularly returns over 9k+ results for queries. Which is a problem since the popular completion plugin nvim-cmp really can't handle things of that nature. I narrowed down the bottleneck to just that.

In order to fix the issue I took a look at yioneko's fork of nvim-cmp. He just implements some async logic when fetching entries from the LSP. My sluggishness has completely gone away!

This issue is fixed by using that fork for the time being, but just thought I would drop a comment here for anyone using facing the same issue!