Compare commits

..

No commits in common. "00f87db6923c696b7d561a5f817aed0dcf3dc48c" and "0e2dcbc55b8300c27ce3d0048ea9a2ba92d590ba" have entirely different histories.

View File

@ -3,7 +3,6 @@ local ensure_installed = {
'clangd', -- C/C++ 'clangd', -- C/C++
'lua_ls', -- Lua 'lua_ls', -- Lua
'opencl_ls', -- OpenCL 'opencl_ls', -- OpenCL
'harper_ls', -- Spelling & grammar
} }
if vim.fn.executable('npm') == 1 then if vim.fn.executable('npm') == 1 then
@ -89,61 +88,44 @@ return {
require('cmp_nvim_lsp').default_capabilities()), require('cmp_nvim_lsp').default_capabilities()),
} }
local lspconfig_custom_opts = {
clangd = {
cmd = { 'clangd', '--completion-style=detailed' },
},
lua_ls = {
settings = {
Lua = {
diagnostics = {
disable = { 'missing-fields', },
globals = { 'vim', },
},
},
},
},
pyright = {
settings = {
pyright = {
disableOrganizeImports = true,
},
},
},
}
require('mason').setup() require('mason').setup()
require('mason-lspconfig').setup({ require('mason-lspconfig').setup({
automatic_installation = false, automatic_installation = false,
ensure_installed = ensure_installed, ensure_installed = ensure_installed,
}) handlers = {
function(server_name)
vim.lsp.config('clangd', { local opts = vim.tbl_deep_extend("force",
cmd = { 'clangd', '--completion-style=detailed' }, lspconfig_default_opts, lspconfig_custom_opts[server_name] or {})
}) require('lspconfig')[server_name].setup(opts)
end,
vim.lsp.config('lua_ls', {
settings = {
Lua = {
diagnostics = {
disable = { 'missing-fields', },
globals = { 'vim', },
},
},
}, },
}) })
vim.lsp.config('pyright', {
settings = {
pyright = {
disableOrganizeImports = true,
},
},
})
vim.lsp.config('harper_ls', {
filetypes = {}, -- Disable for all filetypes
})
-- (Dis|en)able harper-ls when spell mode is (dis|en)enabled.
vim.api.nvim_create_autocmd("OptionSet", {
pattern = "spell",
callback = function()
local bufnr = vim.api.nvim_get_current_buf()
if vim.v.option_new then
vim.lsp.start({
name = "harper_ls",
cmd = { "harper-ls", "--stdio" },
root_dir = vim.fn.getcwd(),
}, { bufnr = bufnr })
else
for _, client in pairs(vim.lsp.get_clients({ bufnr = bufnr })) do
if client.name == "harper_ls" then
vim.lsp.buf_detach_client(bufnr, client.id)
break
end
end
end
end,
})
local cmp = require('cmp') local cmp = require('cmp')
cmp.setup({ cmp.setup({
snippet = { snippet = {