diff options
Diffstat (limited to 'neovim/.config/nvim/lua/plugins')
| -rw-r--r-- | neovim/.config/nvim/lua/plugins/nvim_lspconfig.lua | 346 | 
1 files changed, 173 insertions, 173 deletions
| diff --git a/neovim/.config/nvim/lua/plugins/nvim_lspconfig.lua b/neovim/.config/nvim/lua/plugins/nvim_lspconfig.lua index 06dea97..251261d 100644 --- a/neovim/.config/nvim/lua/plugins/nvim_lspconfig.lua +++ b/neovim/.config/nvim/lua/plugins/nvim_lspconfig.lua @@ -1,186 +1,186 @@  return { -	{ -		dependencies = { -			{ 'williamboman/mason.nvim' }, -			{ 'williamboman/mason-lspconfig.nvim' }, -		}, -		'neovim/nvim-lspconfig', -		lazy = false, -		priority = 800, -		config = function() -			require("mason").setup() -			require("mason-lspconfig").setup() -			local nvim_lsp = require('lspconfig') -			local capabilities = require('cmp_nvim_lsp').default_capabilities() -			-- Use a loop to conveniently call 'setup' on multiple servers and -			-- map buffer local keybindings when the language server attaches -			local servers = { "bashls", "clangd", "cssls", "dockerls", "gopls", "htmx", "jsonls", "marksman", -				"ruff", "rust_analyzer", "taplo", "yamlls" } -			for _, lsp in ipairs(servers) do -				nvim_lsp[lsp].setup { -					capabilities = capabilities, -					flags = { -						debounce_text_changes = 150, -					} -				} -			end +  { +    dependencies = { +      { 'williamboman/mason.nvim' }, +      { 'williamboman/mason-lspconfig.nvim' }, +    }, +    'neovim/nvim-lspconfig', +    lazy = false, +    priority = 800, +    config = function() +      require("mason").setup() +      require("mason-lspconfig").setup() +      local nvim_lsp = require('lspconfig') +      local capabilities = require('cmp_nvim_lsp').default_capabilities() +      -- Use a loop to conveniently call 'setup' on multiple servers and +      -- map buffer local keybindings when the language server attaches +      local servers = { "bashls", "clangd", "cssls", "dockerls", "gopls", "htmx", "jsonls", "marksman", +        "ruff", "rust_analyzer", "taplo", "yamlls" } +      for _, lsp in ipairs(servers) do +        nvim_lsp[lsp].setup { +          capabilities = capabilities, +          flags = { +            debounce_text_changes = 150, +          } +        } +      end -			require 'lspconfig'.basedpyright.setup { -				settings = { -					basedpyright = { -						-- Using Ruff's import organizer -						disableOrganizeImports = true, -					}, -					python = { -						analysis = { -							-- Ignore all files for analysis to exclusively use Ruff for linting -							ignore = { '*' }, -						}, -					}, -				}, -				capabilities = capabilities, -				flags = { -					debounce_text_changes = 150, -				}, -			} +      require 'lspconfig'.basedpyright.setup { +        settings = { +          basedpyright = { +            -- Using Ruff's import organizer +            disableOrganizeImports = true, +          }, +          python = { +            analysis = { +              -- Ignore all files for analysis to exclusively use Ruff for linting +              ignore = { '*' }, +            }, +          }, +        }, +        capabilities = capabilities, +        flags = { +          debounce_text_changes = 150, +        }, +      } -			require 'lspconfig'.lua_ls.setup { -				on_init = function(client) -					local path = client.workspace_folders[1].name -					if vim.loop.fs_stat(path .. '/.luarc.json') or vim.loop.fs_stat(path .. '/.luarc.jsonc') then -						return -					end +      require 'lspconfig'.lua_ls.setup { +        on_init = function(client) +          local path = client.workspace_folders[1].name +          if vim.loop.fs_stat(path .. '/.luarc.json') or vim.loop.fs_stat(path .. '/.luarc.jsonc') then +            return +          end -					client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, { -						runtime = { -							-- Tell the language server which version of Lua you're using -							-- (most likely LuaJIT in the case of Neovim) -							version = 'LuaJIT' -						}, -						-- Make the server aware of Neovim runtime files -						workspace = { -							checkThirdParty = false, -							library = { -								vim.env.VIMRUNTIME -								-- Depending on the usage, you might want to add additional paths here. -								-- "${3rd}/luv/library" -								-- "${3rd}/busted/library", -							} -							-- or pull in all of 'runtimepath'. NOTE: this is a lot slower -							-- library = vim.api.nvim_get_runtime_file("", true) -						} -					}) -				end, -				settings = { -					Lua = { -						format = { -							enable = true, -							defaultConfig = { -								indent_style = "space", -								indent_size = "2", -							} -						}, -					}, +          client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, { +            runtime = { +              -- Tell the language server which version of Lua you're using +              -- (most likely LuaJIT in the case of Neovim) +              version = 'LuaJIT' +            }, +            -- Make the server aware of Neovim runtime files +            workspace = { +              checkThirdParty = false, +              library = { +                vim.env.VIMRUNTIME +                -- Depending on the usage, you might want to add additional paths here. +                -- "${3rd}/luv/library" +                -- "${3rd}/busted/library", +              } +              -- or pull in all of 'runtimepath'. NOTE: this is a lot slower +              -- library = vim.api.nvim_get_runtime_file("", true) +            } +          }) +        end, +        settings = { +          Lua = { +            format = { +              enable = true, +              defaultConfig = { +                indent_style = "space", +                indent_size = "2", +              } +            }, +          }, -				}, -				capabilities = capabilities, -			} +        }, +        capabilities = capabilities, +      } -			require 'lspconfig'.html.setup { -				filetypes = { 'html', 'htmldjango' }, -				capabilities = capabilities, -				flags = { -					debounce_text_changes = 150, -				}, -			} +      require 'lspconfig'.html.setup { +        filetypes = { 'html', 'htmldjango' }, +        capabilities = capabilities, +        flags = { +          debounce_text_changes = 150, +        }, +      } -			require 'lspconfig'.ts_ls.setup { -				filetypes = { 'typescript', 'typescriptreact', 'typescript.tsx' }, -				capabilities = capabilities, -				flags = { -					debounce_text_changes = 150, -				}, -			} +      require 'lspconfig'.ts_ls.setup { +        filetypes = { 'typescript', 'typescriptreact', 'typescript.tsx' }, +        capabilities = capabilities, +        flags = { +          debounce_text_changes = 150, +        }, +      } -			require 'lspconfig'.pylsp.setup { -				settings = { -					pylsp = { -						plugins = { -							autopep8 = { -								enabled = false, -							}, -							black = { -								enabled = false, -							}, -							mccabe = { -								enabled = false, -							}, -							pycodestyle = { -								enabled = false, -							}, -							pyflakes = { -								enabled = false, -							}, -							pylsp_mypy = { -								enabled = false, -							}, -							ruff = { -								enabled = false, -							}, -							yapf = { -								enabled = false, -							}, -						} -					} -				}, -				capabilities = capabilities, -				flags = { -					debounce_text_changes = 150, -				}, -			} +      --require 'lspconfig'.pylsp.setup { +        --settings = { +          --pylsp = { +            --plugins = { +              --autopep8 = { +                --enabled = false, +              --}, +              --black = { +                --enabled = false, +              --}, +              --mccabe = { +                --enabled = false, +              --}, +              --pycodestyle = { +                --enabled = false, +              --}, +              --pyflakes = { +                --enabled = false, +              --}, +              --pylsp_mypy = { +                --enabled = false, +              --}, +              --ruff = { +                --enabled = false, +              --}, +              --yapf = { +                --enabled = false, +              --}, +            --} +          --} +        --}, +        --capabilities = capabilities, +        --flags = { +          --debounce_text_changes = 150, +        --}, +      --} -			require 'lspconfig'.intelephense.setup { -				filetypes = { 'php' }, -				capabilities = capabilities, -				flags = { -					debounce_text_changes = 150, -				}, -				init_options = { -					licenceKey = '~/.config/intelephense/licence.txt', -				}, -			} +      require 'lspconfig'.intelephense.setup { +        filetypes = { 'php' }, +        capabilities = capabilities, +        flags = { +          debounce_text_changes = 150, +        }, +        init_options = { +          licenceKey = '~/.config/intelephense/licence.txt', +        }, +      } -			-- Use LspAttach autocommand to only map the following keys -			-- after the language server attaches to the current buffer -			vim.api.nvim_create_autocmd('LspAttach', { -				group = vim.api.nvim_create_augroup('UserLspConfig', {}), -				callback = function(ev) -					-- Enable completion triggered by <c-x><c-o> -					vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc' +      -- Use LspAttach autocommand to only map the following keys +      -- after the language server attaches to the current buffer +      vim.api.nvim_create_autocmd('LspAttach', { +        group = vim.api.nvim_create_augroup('UserLspConfig', {}), +        callback = function(ev) +          -- Enable completion triggered by <c-x><c-o> +          vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc' -					local opts = { buffer = ev.buf } -					vim.keymap.set('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', { noremap = true }) -					vim.keymap.set('v', '<leader>f', vim.lsp.buf.format, { noremap = true, silent = true }) -					vim.keymap.set('n', '<leader>f', function() -						vim.lsp.buf.format { async = true } -					end, opts) -				end, -			}) +          local opts = { buffer = ev.buf } +          vim.keymap.set('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', { noremap = true }) +          vim.keymap.set('v', '<leader>f', vim.lsp.buf.format, { noremap = true, silent = true }) +          vim.keymap.set('n', '<leader>f', function() +            vim.lsp.buf.format { async = true } +          end, opts) +        end, +      }) -			vim.api.nvim_create_autocmd("LspAttach", { -				group = vim.api.nvim_create_augroup('lsp_attach_disable_ruff_hover', { clear = true }), -				callback = function(args) -					local client = vim.lsp.get_client_by_id(args.data.client_id) -					if client == nil then -						return -					end -					if client.name == 'ruff' then -						-- Disable hover in favor of Pyright -						client.server_capabilities.hoverProvider = false -					end -				end, -				desc = 'LSP: Disable hover capability from Ruff', -			}) -		end, -	}, +      vim.api.nvim_create_autocmd("LspAttach", { +        group = vim.api.nvim_create_augroup('lsp_attach_disable_ruff_hover', { clear = true }), +        callback = function(args) +          local client = vim.lsp.get_client_by_id(args.data.client_id) +          if client == nil then +            return +          end +          if client.name == 'ruff' then +            -- Disable hover in favor of Pyright +            client.server_capabilities.hoverProvider = false +          end +        end, +        desc = 'LSP: Disable hover capability from Ruff', +      }) +    end, +  },  } | 
