From 565e57c0155e31235eb3d2ef0a83fe36d058530a Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Mon, 22 Jul 2024 18:18:10 +0300 Subject: feat(neovim): major lsp refactor and some more lazy loading --- .config/nvim/lua/custom/plugins/lsp-plugins.lua | 72 +++++++++++++++++++++++++ .config/nvim/lua/custom/plugins/lsp.lua | 48 +++++++---------- .config/nvim/lua/custom/plugins/telescope.lua | 1 + 3 files changed, 91 insertions(+), 30 deletions(-) create mode 100644 .config/nvim/lua/custom/plugins/lsp-plugins.lua (limited to '.config/nvim/lua/custom/plugins') diff --git a/.config/nvim/lua/custom/plugins/lsp-plugins.lua b/.config/nvim/lua/custom/plugins/lsp-plugins.lua new file mode 100644 index 0000000..5a6f275 --- /dev/null +++ b/.config/nvim/lua/custom/plugins/lsp-plugins.lua @@ -0,0 +1,72 @@ +return { + { + 'nvimtools/none-ls.nvim', + config = function() + local null_ls = require('null-ls') + null_ls.setup({ + sources = { + null_ls.builtins.formatting.stylua, + }, + }) + end, + }, + -- NOTE: [Good alternative](https://github.com/rachartier/tiny-inline-diagnostic.nvim) + -- although, this plugin is amazing, so I wouldn't switch it most likely + { + 'https://git.sr.ht/~whynothugo/lsp_lines.nvim', + event = 'BufEnter', + config = function() + require('lsp_lines').setup() + vim.keymap.set('n', 'dt', require('lsp_lines').toggle, { desc = '[D]iagnostics [T]oggle inline' }) + end, + }, + { + -- FIXME: fork the repo and fix the following issues + -- Make both insert and normal be toggelable rather than insert always showing and normal toggleable + 'ray-x/lsp_signature.nvim', + event = 'VeryLazy', + opts = { + bind = true, -- This is mandatory, otherwise border config won't get registered. + handler_opts = { border = 'single' }, + doc_lines = 0, + hint_enable = false, + }, + }, + { + 'folke/lazydev.nvim', + ft = 'lua', + opts = { library = { { path = 'luvit-meta/library', words = { 'vim%.uv' } } } }, + }, + { + 'nvimdev/lspsaga.nvim', + dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, + event = 'LspAttach', + opts = { + lightbulb = { + enable = false, + sign = false, + virtual_text = true, + }, + implement = { + sign = false, + virtual_text = true, + }, + floaterm = { + height = 0.7, + width = 0.7, + }, + outline = { + layout = 'float', + }, + -- TODO: Change in rename to smthing else + -- bcz I am using for moving between windows + -- Maybe for abort, for confirm + }, + }, + + -- AUtoformatting + -- 'stevear/conform.nvim', + + -- Schema info + -- 'b0o/SchemaStore.nvim', +} diff --git a/.config/nvim/lua/custom/plugins/lsp.lua b/.config/nvim/lua/custom/plugins/lsp.lua index 3f12e9a..f6b8b28 100644 --- a/.config/nvim/lua/custom/plugins/lsp.lua +++ b/.config/nvim/lua/custom/plugins/lsp.lua @@ -1,36 +1,24 @@ return { - { - 'neovim/nvim-lspconfig', - lazy = false, - dependencies = { - 'williamboman/mason.nvim', + -- NOTE: Make sure the order is as follows: + -- Mason loads -> Mason lspconfig loads -> Lspconfig loads + 'neovim/nvim-lspconfig', + event = { 'BufReadPre', 'BufNewFile' }, + dependencies = { + 'hrsh7th/cmp-nvim-lsp', + { 'antosha417/nvim-lsp-file-operations', conifg = true }, + { 'williamboman/mason-lspconfig.nvim', - - 'nvimtools/none-ls.nvim', - - -- NOTE: [Good alternative](https://github.com/rachartier/tiny-inline-diagnostic.nvim) - -- although, this plugin is amazing, so I wouldn't switch it most likely - { 'https://git.sr.ht/~whynothugo/lsp_lines.nvim' }, - - { - 'nvimdev/lspsaga.nvim', - dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, + dependencies = { + { 'williamboman/mason.nvim', cmd = 'Mason' }, + 'WhoIsSethDaniel/mason-tool-installer.nvim', }, - { - 'folke/lazydev.nvim', - ft = 'lua', - opts = { library = { { path = 'luvit-meta/library', words = { 'vim%.uv' } } } }, - }, - { 'ray-x/lsp_signature.nvim', event = 'VeryLazy' }, - - -- AUtoformatting - -- 'stevear/conform.nvim', - - -- Schema info - -- 'b0o/SchemaStore.nvim', + build = ':MasonUpdate', + config = function() + require('custom.configs.mason') + end, }, - config = function() - require('custom.lsp') - end, }, + config = function() + require('custom.configs.lsp') + end, } diff --git a/.config/nvim/lua/custom/plugins/telescope.lua b/.config/nvim/lua/custom/plugins/telescope.lua index 6de07d5..1d8f49c 100644 --- a/.config/nvim/lua/custom/plugins/telescope.lua +++ b/.config/nvim/lua/custom/plugins/telescope.lua @@ -6,6 +6,7 @@ return { { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }, 'nvim-telescope/telescope-ui-select.nvim', }, + cmd = 'Telescope', config = function() require('custom.telescope') end, -- cgit v1.3.1