From c489d393695e90d424f9ae51e35c4d42358e6a71 Mon Sep 17 00:00:00 2001 From: Squibid Date: Fri, 9 Aug 2024 02:45:31 -0400 Subject: yes there's a bit of java in my nvim config why do you ask? --- after/plugin/lsp.lua | 92 ---------------------------------------------------- 1 file changed, 92 deletions(-) delete mode 100644 after/plugin/lsp.lua (limited to 'after/plugin/lsp.lua') diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua deleted file mode 100644 index c74eaab..0000000 --- a/after/plugin/lsp.lua +++ /dev/null @@ -1,92 +0,0 @@ -local status_ok, lspconfig = pcall(require, "lspconfig") -if not status_ok then - return -end - --- configure lsp when attached -local function lsp_attach(client, bufnr) - -- helper functions - local function set_lsp_sign(name, text) - vim.fn.sign_define(name, { text = text, texthl = name }) - end - - local function map(m, lhs, rhs) - local opts = { remap = false, silent = true, buffer = bufnr } - vim.keymap.set(m, lhs, rhs, opts) - end - set_lsp_sign("DiagnosticSignError", "x") - set_lsp_sign("DiagnosticSignWarn" , "!") - set_lsp_sign("DiagnosticSignInfo" , "i") - set_lsp_sign("DiagnosticSignHint" , "h") - - -- LSP actions - map('n', 'K', 'lua vim.lsp.buf.hover()') - map('n', 'gD', 'lua vim.lsp.buf.definition()') - -- map('n', 'gD', 'lua vim.lsp.buf.declaration()') - map('n', 'gI', 'lua vim.lsp.buf.implementation()') - map('n', 'gY', 'lua vim.lsp.buf.type_definition()') - map('n', 'gR', 'lua vim.lsp.buf.references()') - map('n', '', 'lua vim.lsp.buf.signature_help()') - map('n', 'lr', 'lua vim.lsp.buf.rename()') - map('n', '', 'lua vim.lsp.buf.rename()') - map('n', '', 'lua vim.lsp.buf.code_action()') - - -- Diagnostics - map('n', '[d', 'lua vim.diagnostic.goto_prev()') - map('n', ']d', 'lua vim.diagnostic.goto_next()') - - vim.api.nvim_buf_create_user_command(bufnr, 'LspFormat', function() - vim.lsp.buf.format() - end, {desc = 'Format buffer with language server'}) - vim.api.nvim_buf_create_user_command('LspWorkspaceAdd', function() - vim.lsp.buf.add_workspace_folder() - end, { desc = 'Add folder to workspace' }) - vim.api.nvim_buf_create_user_command('LspWorkspaceList', function() - vim.notify(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, { desc = 'List workspace folders' }) - vim.api.nvim_buf_create_user_command('LspWorkspaceRemove', function() - vim.lsp.buf.remove_workspace_folder() - end, { desc = 'Remove folder from workspace' }) -end - -vim.diagnostic.config({ - virtual_text = false, - signs = true, - update_in_insert = false, - underline = true, - severity_sort = true, -}) - -vim.lsp.handlers['textDocument/hover'] = vim.lsp.with( - vim.lsp.handlers.hover, { - border = 'solid', - }) - -vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with( - vim.lsp.handlers.signature_help, { - border = 'solid', - }) - --- get servers and attach to them -local status_ok1, mason = pcall(require, "mason") -if not status_ok1 then - return -end -mason.setup {} - -local status_ok2, masonlspconfig = pcall(require, "mason-lspconfig") -if not status_ok2 then - return -end -masonlspconfig.setup {} -masonlspconfig.setup_handlers { - function (server_name) - lspconfig[server_name].setup { on_attach = lsp_attach } - end, - - -- specific servers can be setup as follows: - -- ["rust_analyzer"] = function () - -- require("rust-tools").setup {} - -- end - -- check out :help mason-lspconfig for more info -} -- cgit v1.2.1