nvim: lsp-utils: Configuration updates in line with lspconfig

This commit is contained in:
Sanchayan Maity 2023-10-14 10:34:11 +05:30
parent 8bfc5b630f
commit fc80b95131
Signed by: sanchayanmaity
GPG key ID: 6F6A0609C12038F3

View file

@ -96,11 +96,15 @@ function M.clangd_config()
local root_files = { '.clangd', '.clang-tidy', '.clang-format', 'compile_commands.json', 'compile_flags.txt' }
local clangd_cmd = { "clangd", "--background-index", "--pch-storage=memory", "--clang-tidy", "--header-insertion=never" }
local root_directory = get_root_directory(root_files)
local clangd_caps = {
textDocument = { completion = { editsNearCursor = true } },
offsetEncoding = { 'utf-8', 'utf-16' },
}
return {
name = "clangd",
cmd = clangd_cmd,
capabilities = default_capabilities,
capabilities = clangd_caps,
root_dir = root_directory,
filetypes = { 'c', 'cpp' },
single_file_support = true,
@ -118,9 +122,19 @@ function M.deno_config()
capabilities = default_capabilities,
filetypes = file_types,
root_dir = root_directory,
init_options = {
settings = {
deno = {
enable = true,
unstable = false,
suggest = {
imports = {
hosts = {
['https://deno.land'] = true,
['https://crux.land'] = true,
['https://x.nest.land'] = true,
},
},
},
},
},
handlers = {
['textDocument/definition'] = denols_handler,
@ -201,11 +215,16 @@ end
function M.ra_config()
local root_files = { "Cargo.toml" }
local root_directory = get_root_directory(root_files)
local ra_caps = vim.lsp.protocol.make_client_capabilities()
ra_caps.experimental = {
serverStatusNotification = true,
}
return {
name = "rust-analyzer",
cmd = { "rust-analyzer" },
capabilities = default_capabilities,
capabilities = ra_caps,
root_dir = root_directory,
settings = {
["rust-analyzer"] = {
@ -242,6 +261,10 @@ function M.tsserver_config()
return {
name = "tsserver",
cmd = { "typescript-language-server", "--stdio" },
-- Support Yarn PnP
-- hostInfo with init_options is required to allow yarn pnp sdk to
-- identify editor and patch paths appropriately.
init_options = { hostInfo = 'neovim' },
capabilities = default_capabilities,
root_dir = root_directory,
filetypes = file_types,