From 7a6c02dd199f62e4c87c4e9641b0963c6b0ad81f Mon Sep 17 00:00:00 2001 From: ray-x Date: Tue, 21 Feb 2023 11:22:55 +1100 Subject: [PATCH] mason/mason-lspconfig instructions --- README.md | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index cdcd013..6201183 100644 --- a/README.md +++ b/README.md @@ -949,15 +949,13 @@ This gopls setup provided by go.nvim works perfectly fine for most of the cases. For diagnostic issue, you can use the default setup. There are also quite a few plugins that you can use to explore issues, e.g. [navigator.lua](https://github.com/ray-x/navigator.lua), [folke/lsp-trouble.nvim](https://github.com/folke/lsp-trouble.nvim). [Nvim-tree](https://github.com/kyazdani42/nvim-tree.lua) and [Bufferline](https://github.com/akinsho/nvim-bufferline.lua) also introduced lsp diagnostic hooks. -## Integrate with nvim-lsp-installer +## Integrate with mason-lspconfig -(suggested by @mattbailey) ```lua -local path = require 'nvim-lsp-installer.core.path' -local install_root_dir = path.concat {vim.fn.stdpath 'data', 'lsp_servers'} - -require('go').setup({ +require("mason").setup() +require("mason-lspconfig").setup() +require('lspconfig').go.setup({ gopls_cmd = {install_root_dir .. '/go/gopls'}, fillstruct = 'gopls', dap_debug = true, @@ -971,22 +969,15 @@ If you want to use gopls setup provided by go.nvim -- setup your go.nvim -- make sure lsp_cfg is disabled -require('go').setup{...} - -local lsp_installer_servers = require'nvim-lsp-installer.servers' - -local server_available, requested_server = lsp_installer_servers.get_server("gopls") -if server_available then - requested_server:on_ready(function () - local opts = require'go.lsp'.config() -- config() return the go.nvim gopls setup - requested_server:setup(opts) - end) - if not requested_server:is_installed() then - -- Queue the server to be installed - requested_server:install() - end -end +require("mason").setup() +require("mason-lspconfig").setup() +require('go').setup{ + lsp_cfg = false + -- other setups... +} +local cfg = require'go.lsp'.config() -- config() return the go.nvim gopls setup +require('lspconfig').go.setup(cfg) ``` ## Integrate null-ls