feat: LSP for Rust

This commit is contained in:
Muhammad Nauman Raza 2024-09-23 12:35:12 +01:00
parent b3af59b5b2
commit 4dfc96a99a
Signed by: devraza
GPG key ID: 91EAD6081011574B

View file

@ -10,7 +10,15 @@ require("lazy").setup({
"nvim-telescope/telescope.nvim",
dependencies = { 'nvim-lua/plenary.nvim' },
},
-- Language servers
"neovim/nvim-lspconfig",
"VonHeikemen/lsp-zero.nvim", branch = "v4.x",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/nvim-cmp",
"williamboman/mason.nvim",
'williamboman/mason-lspconfig.nvim',
"romgrk/barbar.nvim",
"nvim-lualine/lualine.nvim",
{"ellisonleao/glow.nvim", config = true, cmd = "Glow"},
@ -60,3 +68,28 @@ require("toggleterm").setup{
-- Imports from files
require 'core'
-- Language server configuration
require("mason").setup()
require('mason-lspconfig').setup({
handlers = {
function(server_name)
require('lspconfig')[server_name].setup({})
end,
},
})
require('lspconfig').gopls.setup({})
require('lspconfig').rust_analyzer.setup({})
require('lsp-zero').setup_servers({'gopls', 'rust_analyzer'})
local cmp = require('cmp')
cmp.setup({
sources = {
{name = 'nvim_lsp'},
},
mapping = cmp.mapping.preset.insert({}),
snippet = {
expand = function(args)
vim.snippet.expand(args.body)
end,
},
})