mason/mason-lspconfig instructions

pull/298/head
ray-x 1 year ago
parent 290ecba852
commit 7a6c02dd19

@ -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

Loading…
Cancel
Save