-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlsp.lua
More file actions
49 lines (42 loc) · 1.22 KB
/
lsp.lua
File metadata and controls
49 lines (42 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
local util = require('lspconfig.util')
require('lsp_on_attach').setup()
-- languages
local languages = { 'pyright', 'gopls', 'rust_analyzer', 'ts_ls', 'lua_ls', 'dartls', 'html', 'marksman',
'protobuf-language-server', 'sqls', 'denols', 'volar', 'tailwindcss', 'html', 'cssls', 'kotlin_lsp' }
-- html、cssls
-- npm i -g vscode-langservers-extracted
-- setup nvim-cmp
local capabilities = require('cmp_nvim_lsp').default_capabilities()
vim.lsp.config("protobuf-language-server", {
cmd = { vim.fn.expand('~/.gvm/pkgsets/go1.22/global/bin/protobuf-language-server') },
filetypes = { 'proto', 'cpp' },
root_fir = util.root_pattern('.git'),
single_file_support = true,
})
vim.lsp.enable("protobuf-language-server")
-- java 配置在 ffplugin/java.lua 下
for _, lsp in ipairs(languages) do
local config = {
capabilities = capabilities
}
if lsp == 'lua_ls' then
config.settings = {
Lua = {
runtime = {
version = "LuaJIT"
},
diagnostics = {
globals = { 'vim' }
}
}
}
elseif lsp == 'gopls' then
config.settings = {
gopls = {
buildFlags = { '-tags=integration' }
}
}
end
vim.lsp.config(lsp, config)
vim.lsp.enable(lsp)
end