nvim dot files

add rust to lsp config

+28 -4
+28 -4
lua/plugins/lsp.lua
··· 11 "williamboman/mason-lspconfig.nvim", 12 config = function() 13 require('mason-lspconfig').setup({ 14 - ensure_installed = { "pyright", "tsserver", "rust_analyzer" }, 15 }) 16 end, 17 }, ··· 33 34 lspconfig.pyright.setup({ on_attach = on_attach }) 35 lspconfig.tsserver.setup({ on_attach = on_attach }) 36 lspconfig.zls.setup({ 37 on_attach = on_attach, 38 settings = { ··· 60 ['<C-Space>'] = cmp.mapping.complete(), 61 ['<C-e>'] = cmp.mapping.abort(), 62 ['<CR>'] = cmp.mapping.confirm({ select = true }), 63 }), 64 sources = cmp.config.sources({ 65 - { name = 'nvim_lsp' }, 66 - }, { 67 - { name = 'buffer' }, 68 }) 69 }) 70 end,
··· 11 "williamboman/mason-lspconfig.nvim", 12 config = function() 13 require('mason-lspconfig').setup({ 14 + ensure_installed = { "pyright", "tsserver", "rust_analyzer", "zls" }, 15 }) 16 end, 17 }, ··· 33 34 lspconfig.pyright.setup({ on_attach = on_attach }) 35 lspconfig.tsserver.setup({ on_attach = on_attach }) 36 + lspconfig.rust_analyzer.setup({ 37 + on_attach = on_attach, 38 + settings = { 39 + ["rust-analyzer"] = { 40 + imports = { 41 + granularity = { 42 + group = "module", 43 + }, 44 + prefix = "self", 45 + }, 46 + cargo = { 47 + buildScripts = { 48 + enable = true, 49 + }, 50 + }, 51 + procMacro = { 52 + enable = true 53 + }, 54 + } 55 + } 56 + }) 57 + 58 lspconfig.zls.setup({ 59 on_attach = on_attach, 60 settings = { ··· 82 ['<C-Space>'] = cmp.mapping.complete(), 83 ['<C-e>'] = cmp.mapping.abort(), 84 ['<CR>'] = cmp.mapping.confirm({ select = true }), 85 + ['<C-p>'] = cmp.mapping.select_prev_item(), 86 + ['<C-n>'] = cmp.mapping.select_next_item(), 87 }), 88 sources = cmp.config.sources({ 89 + {name = 'nvim_lsp' }, 90 + {name = 'buffer' }, 91 + {name = 'path' }, 92 }) 93 }) 94 end,