nvim: lsp-utils: Miscellaneous clean ups

- Drop bash language server. We do not want to run JS/TS
based garbage. Now that we do not need to do any official
work on JS/TS, we can get rid of all npm/yarn/pnpm shit.
- Remove settings for inlay hints for TS server as lot of
idiots writing TS do not provide type annotations all the
time. ts_ls is also not useful at providing type hints, so
inlay hints have never been useful.
- Prevent clangd from running on single files.
This commit is contained in:
Sanchayan Maity 2024-12-07 19:17:53 +05:30
parent 82a5dedbfe
commit 6c304556f8
Signed by: sanchayanmaity
GPG key ID: 6F6A0609C12038F3

View file

@ -77,31 +77,6 @@ end
local default_capabilities = vim.lsp.protocol.make_client_capabilities() local default_capabilities = vim.lsp.protocol.make_client_capabilities()
function M.bashls_config()
local root_directory = vim.fn.getcwd()
return {
name = "bashls",
cmd = { 'bash-language-server', 'start' },
capabilities = default_capabilities,
root_dir = root_directory,
filetypes = { 'sh' },
single_file_support = true,
settings = {
bashIde = {
-- Glob pattern for finding and parsing shell script files in the workspace.
-- Used by the background analysis features across files.
-- Prevent recursive scanning which will cause issues when opening a file
-- directly in the home directory (e.g. ~/foo.sh).
--
-- Default upstream pattern is "**/*@(.sh|.inc|.bash|.command)".
globPattern = vim.env.GLOB_PATTERN or '*@(.sh|.inc|.bash|.command)',
},
},
}
end
function M.clangd_config() function M.clangd_config()
local root_files = { '.clangd', '.clang-tidy', '.clang-format', 'compile_commands.json', 'compile_flags.txt' } 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 clangd_cmd = { "clangd", "--background-index", "--pch-storage=memory", "--clang-tidy", "--header-insertion=never" }
@ -117,7 +92,7 @@ function M.clangd_config()
capabilities = clangd_caps, capabilities = clangd_caps,
root_dir = root_directory, root_dir = root_directory,
filetypes = { 'c', 'cpp' }, filetypes = { 'c', 'cpp' },
single_file_support = true, single_file_support = false,
} }
end end
@ -317,39 +292,12 @@ function M.tsserver_config()
local root_directory = get_root_directory(root_files) local root_directory = get_root_directory(root_files)
return { return {
name = "tsserver", name = "ts_ls",
cmd = { "typescript-language-server", "--stdio" }, 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' }, init_options = { hostInfo = 'neovim' },
capabilities = default_capabilities, capabilities = default_capabilities,
root_dir = root_directory, root_dir = root_directory,
filetypes = file_types, filetypes = file_types
settings = {
typescript = {
inlayHints = {
includeInlayParameterNameHints = 'all',
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
includeInlayFunctionParameterTypeHints = true,
includeInlayVariableTypeHints = true,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayEnumMemberValueHints = true,
}
},
javascript = {
inlayHints = {
includeInlayParameterNameHints = 'all',
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
includeInlayFunctionParameterTypeHints = true,
includeInlayVariableTypeHints = true,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayEnumMemberValueHints = true,
}
}
}
} }
end end