oil.nvim icon indicating copy to clipboard operation
oil.nvim copied to clipboard

Feature Request: Option to Disable LSP in Preview Window

Open kevintraver opened this issue 1 year ago • 1 comments

It does not always make sense to have the LSP attached the preview window.

kevintraver avatar Mar 27 '24 14:03 kevintraver

Something like this might work:

if config.preview.disable_diagnostics then
  local clients = vim.lsp.get_active_clients({ bufnr = bufnr })
  for _, client in ipairs(clients) do
    if vim.lsp.buf_is_attached(bufnr, client.id) then
      vim.lsp.buf_detach_client(bufnr, client.id)
    end
  end
end

But I'm not exactly sure where the best place is because of how the preview buffer loads.

kevintraver avatar Mar 28 '24 15:03 kevintraver

It does not always make sense to have the LSP attached the preview window.

I'd argue it never makes sense, and would be nice to be set to off by default or completely throw away. Not only pointless overload of operations when scrolling through entries, but larger surface for potential breakage. Had to disable some async lsp capabilities to get rid of the storm of errors as buffers get swapped faster than lsp is able to handle it and likely due to async nature of lsp operations, no amount of trying to prevent this, detach lsp or anything of sorts helped. Still getting spammed with lps progress indicators (notifications, fidget...) going crazy as I cycle entries. Would maybe make sense to prevent lsp from loading in the first place, or create a copy of buf with telescope syntax only to display as prev... But it is slightly outside of my capabilities for now, and I am quite swamped with school/work. It is not complaining - it's an honest opinion and some ideas added on top. Frankly at this point a plain white text preview would be preferable to me.

tom-gora avatar Oct 20 '24 18:10 tom-gora