From 3498d29f9d7b89814c910f835ca555e8a485c931 Mon Sep 17 00:00:00 2001 From: serxoz Date: Tue, 2 Aug 2022 18:03:24 +0200 Subject: [PATCH] lsp funcionando para golang --- nvim/after/plugin/init.lua | 1 + nvim/custom/chadrc.lua | 5 ----- nvim/custom/plugins/init.lua | 30 +++++++++++++++--------------- nvim/custom/plugins/lspconfig.lua | 24 ++++++++++-------------- 4 files changed, 26 insertions(+), 34 deletions(-) diff --git a/nvim/after/plugin/init.lua b/nvim/after/plugin/init.lua index 2b710a4..3e73b8e 100644 --- a/nvim/after/plugin/init.lua +++ b/nvim/after/plugin/init.lua @@ -1 +1,2 @@ vim.cmd(":TSInstall all"); +-- vim.cmd(":MasonInstallAll") diff --git a/nvim/custom/chadrc.lua b/nvim/custom/chadrc.lua index 3a17725..01978b9 100644 --- a/nvim/custom/chadrc.lua +++ b/nvim/custom/chadrc.lua @@ -6,11 +6,6 @@ M.plugins = { override = { ["nvim-treesitter/nvim-treesitter"] = override.treesitter, }, - options = { - lspconfig = { - setup_lspconf = "custom.plugins.lspconfig" - }, - }, user = require "custom.plugins", } diff --git a/nvim/custom/plugins/init.lua b/nvim/custom/plugins/init.lua index 3ca13d9..4888e87 100644 --- a/nvim/custom/plugins/init.lua +++ b/nvim/custom/plugins/init.lua @@ -1,17 +1,17 @@ return { - ["neovim/nvim-lspconfig"] = { - config = function() - require "plugins.configs.lspconfig" - require "custom.plugins.lspconfig" - end, - }, - ['ThePrimeagen/harpoon'] = { - module = "harpoon", - ft = "harpoon", - config = function() - require "custom.plugins.harpoon" - end, - }, - ['ray-x/go.nvim'] = {}, - ['ray-x/guihua.lua'] = {}, + ["neovim/nvim-lspconfig"] = { + config = function() + require "plugins.configs.lspconfig" + require "custom.plugins.lspconfig" + end, + }, + ['ThePrimeagen/harpoon'] = { + module = "harpoon", + ft = "harpoon", + config = function() + require "custom.plugins.harpoon" + end, + }, + ['ray-x/go.nvim'] = {}, + ['ray-x/guihua.lua'] = {}, } diff --git a/nvim/custom/plugins/lspconfig.lua b/nvim/custom/plugins/lspconfig.lua index ba1d9a6..4b81db4 100644 --- a/nvim/custom/plugins/lspconfig.lua +++ b/nvim/custom/plugins/lspconfig.lua @@ -1,17 +1,13 @@ -local M = {} +-- custom.plugins.lspconfig +local on_attach = require("plugins.configs.lspconfig").on_attach +local capabilities = require("plugins.configs.lspconfig").capabilities -M.setup_lsp = function(attach, capabilities) - local lspconfig = require "lspconfig" +local lspconfig = require "lspconfig" +local servers = { "html", "cssls", "clangd", "gopls"} - -- lspserver with default config - local servers = { "html", "cssls", "gopls", "jedi_language_server"} - - for _, lsp in ipairs(servers) do - lspconfig[lsp].setup { - on_attach = attach, - capabilities = capabilities, - } - end +for _, lsp in ipairs(servers) do + lspconfig[lsp].setup { + on_attach = on_attach, + capabilities = capabilities, + } end - -return M