Compare commits
2 Commits
0e2dcbc55b
...
00f87db692
Author | SHA1 | Date | |
---|---|---|---|
00f87db692 | |||
5a265839f9 |
@ -3,6 +3,7 @@ local ensure_installed = {
|
||||
'clangd', -- C/C++
|
||||
'lua_ls', -- Lua
|
||||
'opencl_ls', -- OpenCL
|
||||
'harper_ls', -- Spelling & grammar
|
||||
}
|
||||
|
||||
if vim.fn.executable('npm') == 1 then
|
||||
@ -88,12 +89,17 @@ return {
|
||||
require('cmp_nvim_lsp').default_capabilities()),
|
||||
}
|
||||
|
||||
local lspconfig_custom_opts = {
|
||||
clangd = {
|
||||
cmd = { 'clangd', '--completion-style=detailed' },
|
||||
},
|
||||
require('mason').setup()
|
||||
require('mason-lspconfig').setup({
|
||||
automatic_installation = false,
|
||||
ensure_installed = ensure_installed,
|
||||
})
|
||||
|
||||
lua_ls = {
|
||||
vim.lsp.config('clangd', {
|
||||
cmd = { 'clangd', '--completion-style=detailed' },
|
||||
})
|
||||
|
||||
vim.lsp.config('lua_ls', {
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
@ -102,28 +108,40 @@ return {
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
pyright = {
|
||||
vim.lsp.config('pyright', {
|
||||
settings = {
|
||||
pyright = {
|
||||
disableOrganizeImports = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
require('mason').setup()
|
||||
require('mason-lspconfig').setup({
|
||||
automatic_installation = false,
|
||||
ensure_installed = ensure_installed,
|
||||
handlers = {
|
||||
function(server_name)
|
||||
local opts = vim.tbl_deep_extend("force",
|
||||
lspconfig_default_opts, lspconfig_custom_opts[server_name] or {})
|
||||
require('lspconfig')[server_name].setup(opts)
|
||||
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')
|
||||
|
Loading…
x
Reference in New Issue
Block a user