tangled
alpha
login
or
join now
shailpatels.me
/
nvim
0
fork
atom
nvim dot files
0
fork
atom
overview
issues
pulls
pipelines
add rust to lsp config
shailpatels.me
2 years ago
51ff4843
a994b372
+28
-4
1 changed file
expand all
collapse all
unified
split
lua
plugins
lsp.lua
+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 })
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 }),
0
0
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,