Skip to content

Commit

Permalink
Move LSP management to mason.nvim.
Browse files Browse the repository at this point in the history
  • Loading branch information
miltonllera committed Jan 17, 2023
1 parent 5c2bdaa commit 1a57c8c
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
10 changes: 8 additions & 2 deletions lua/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,20 @@ return require('packer').startup(function(use)
-- Let Packer manage itself
use({'wbthomason/packer.nvim', opt = true})

-- LSP management (must come first as per mason-lspconfig.nvim's instructions)
use "williamboman/mason.nvim"
use ({
"williamboman/mason-lspconfig.nvim",
config = function() require('plugins.mason-lspconfig') end,
})

-- LSP server
use({
'neovim/nvim-lspconfig',
config = function() require('plugins.lspconfig') end
})
use 'williamboman/nvim-lsp-installer' -- Helper for installing most language servers

-- Autocomplete
-- Autocomplete
use({
"hrsh7th/nvim-cmp",
-- Sources for nvim-cmp
Expand Down
9 changes: 8 additions & 1 deletion lua/plugins/lspconfig.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)

-- Enable language servers with common settings
local servers = {"bashls", "clangd", "pyright", "jsonls", "dockerls"}
local servers = {
"bashls",
"clangd",
"dockerls",
"jsonls",
"pyright",
"texlab",
}
for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup({
on_attach = common_on_attach,
Expand Down
12 changes: 12 additions & 0 deletions lua/plugins/mason-lspconfig.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require("mason-lspconfig").setup {
ensure_installed = {
"bashls",
"clangd",
"jsonls",
"julials",
"pyright",
"sumneko_lua",
"texlab",
},
automatic_installation= true,
}
6 changes: 5 additions & 1 deletion lua/plugins/treesitter.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
-- Treesitter configuration

require('nvim-treesitter.configs').setup({
highlight = { enable = true, additional_vim_regex_highlighting = false},
highlight = {
enable = true,
additional_vim_regex_highlighting = false
},
-- We must manually specify which parsers to install
ensure_installed = {
"bash",
Expand All @@ -14,5 +17,6 @@ require('nvim-treesitter.configs').setup({
"python",
"yaml",
"vim",
"latex",
},
})

0 comments on commit 1a57c8c

Please sign in to comment.