You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
104 lines
3.2 KiB
Lua
104 lines
3.2 KiB
Lua
local cmp = require("cmp")
|
|
|
|
cmp.setup({
|
|
snippet = {
|
|
-- REQUIRED - you must specify a snippet engine
|
|
expand = function(args)
|
|
--vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
|
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
|
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
|
|
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
|
end,
|
|
},
|
|
window = {
|
|
-- completion = cmp.config.window.bordered(),
|
|
-- documentation = cmp.config.window.bordered(),
|
|
},
|
|
mapping = cmp.mapping.preset.insert({
|
|
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
|
['<C-Space>'] = cmp.mapping.complete(),
|
|
['<C-e>'] = cmp.mapping.abort(),
|
|
['<Tab>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
|
}),
|
|
sources = cmp.config.sources({
|
|
{ name = 'nvim_lsp' },
|
|
-- { name = 'vsnip' }, -- For vsnip users.
|
|
{ name = 'luasnip' }, -- For luasnip users.
|
|
-- { name = 'ultisnips' }, -- For ultisnips users.
|
|
-- { name = 'snippy' }, -- For snippy users.
|
|
}, {
|
|
{ name = 'buffer' },
|
|
})
|
|
})
|
|
|
|
local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
|
|
|
require("lspconfig").ts_ls.setup({})
|
|
|
|
require("lspconfig").clangd.setup({})
|
|
|
|
require("lspconfig").gopls.setup({
|
|
cmd = { "gopls", "serve" },
|
|
settings = {
|
|
gopls = {
|
|
analyses = {
|
|
unusedparams = true,
|
|
},
|
|
staticcheck = true,
|
|
},
|
|
},
|
|
})
|
|
|
|
require'lspconfig'.pyright.setup{}
|
|
|
|
require("lspconfig").rust_analyzer.setup({
|
|
--cmd = { "rustup", "run", "nightly", "rust-analyzer" },
|
|
settings = {
|
|
['rust-analyzer'] = {
|
|
checkOnSave = {
|
|
allFeatures = true,
|
|
overrideCommand = {
|
|
'cargo', 'clippy', '--workspace', '--message-format=json',
|
|
'--all-targets', '--all-features'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
|
|
require('lspconfig').kotlin_language_server.setup({
|
|
cmd = { "kotlin-language-server" },
|
|
filetypes = { "kotlin"} ,
|
|
})
|
|
|
|
require'nvim-treesitter.configs'.setup {
|
|
-- Install parsers synchronously (only applied to `ensure_installed`)
|
|
sync_install = false,
|
|
highlight = {
|
|
-- `false` will disable the whole extension
|
|
enable = true,
|
|
|
|
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
|
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
|
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
|
-- Instead of true it can also be a list of languages
|
|
additional_vim_regex_highlighting = false,
|
|
},
|
|
}
|
|
|
|
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
|
vim.lsp.diagnostic.on_publish_diagnostics, {
|
|
update_in_insert = true,
|
|
}
|
|
)
|
|
|
|
require'lspconfig'.cmake.setup{}
|
|
|
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
|
|
|
require'lspconfig'.html.setup {
|
|
capabilities = capabilities,
|
|
}
|